/* inflo — global stiller */
:root {
    --inflo-primary:  #0E1B3D;
    --inflo-accent:   #00D1C8;
    --inflo-surface:  #F4F6FB;
    --inflo-charcoal: #1A1A2E;
    --inflo-mist:     #6B7591;
    --inflo-coral:    #FF6B5B;
    --inflo-mint:     #22C55E;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--inflo-surface);
    color: var(--inflo-charcoal);
    font-size: 14px;
    line-height: 1.5;
}

/* Global resim koruması — natural-size kontrolsüz büyümeyi engeller */
img { max-width: 100%; height: auto; }

a { color: var(--inflo-primary); text-decoration: none; }
a:hover { color: var(--inflo-accent); }

/* ─── Layout & Sidebar ──────────────────────────────────────── */
.inflo-app { display: flex; min-height: 100vh; }

.inflo-sidebar {
    width: 248px;
    min-width: 248px;
    max-width: 248px;
    background: linear-gradient(180deg, var(--inflo-primary) 0%, #08122a 100%);
    color: white;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* inflo brand stripe (sidebar üstüne küçük "Powered by inflo." rozeti) */
.inflo-sidebar .inflo-brand-stripe {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 8px 20px 4px;
    text-decoration: none;
    transition: opacity 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin: 0 0 4px;
}
.inflo-sidebar .inflo-brand-stripe:hover { opacity: 0.85; }
.inflo-sidebar .inflo-brand-stripe .wm {
    font-size: 16px;
    font-weight: 800;
    color: white;
    letter-spacing: -0.02em;
    line-height: 1;
}
.inflo-sidebar .inflo-brand-stripe .wm .dt { color: var(--inflo-accent); }
.inflo-sidebar .inflo-brand-stripe .ln {
    font-size: 9.5px;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
}

/* Logo bloğu — tenant logosu, tıklanır ana sayfaya gider */
.inflo-sidebar .logo {
    padding: 6px 20px 22px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 56px;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s;
}
.inflo-sidebar .logo:hover { opacity: 0.85; }
.inflo-sidebar .logo img {
    max-height: 40px !important;
    max-width: 200px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    display: block;
}
.inflo-sidebar .logo .wordmark {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    color: white;
}
.inflo-sidebar .logo .dot { color: var(--inflo-accent); }

/* Nav konteyner */
.inflo-sidebar nav {
    padding: 0 10px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* SVG ikon */
.inflo-icon {
    flex-shrink: 0;
    color: rgba(255,255,255,0.55);
    transition: color 0.18s, transform 0.18s;
}

/* Accordion grup */
.nav-group { margin-bottom: 4px; }

.nav-group-head {
    width: 100%;
    background: transparent;
    border: 0;
    color: rgba(255,255,255,0.45);
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    padding: 14px 14px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: color 0.15s;
}
.nav-group-head:hover { color: rgba(255,255,255,0.7); }
.nav-group-head .inflo-icon {
    width: 14px; height: 14px;
    transition: transform 0.2s;
    color: rgba(255,255,255,0.35);
}
.nav-group.open .nav-group-head .inflo-icon { transform: rotate(180deg); color: var(--inflo-accent); }

.nav-group-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
}
.nav-group.open .nav-group-body {
    max-height: 800px;
}

/* Nav link (her menü öğesi) */
.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px 9px 14px;
    color: rgba(255,255,255,0.78);
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 2px;
    text-decoration: none;
    cursor: pointer;
    border: 0;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
    line-height: 1.25;
}
.nav-link .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link .ic .inflo-icon { color: rgba(255,255,255,0.55); }

.nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}
.nav-link:hover .inflo-icon { color: var(--inflo-accent); }

.nav-link.active {
    background: linear-gradient(90deg, rgba(0,209,200,0.18) 0%, rgba(0,209,200,0.04) 100%);
    color: var(--inflo-accent);
    font-weight: 600;
}
.nav-link.active .inflo-icon { color: var(--inflo-accent); }
.nav-link.active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 7px;
    bottom: 7px;
    width: 3px;
    background: var(--inflo-accent);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 12px var(--inflo-accent);
}

/* Child link (ikinci seviye — Reddedilenler, alt anlaşma sayfaları) */
.nav-link--child {
    padding-left: 44px;
    font-size: 12.5px;
    color: rgba(255,255,255,0.55);
    font-weight: 500;
}
.nav-link--child::before { display: none; }
.nav-link--child:hover { color: white; background: rgba(255,255,255,0.03); }
.nav-link--child.active {
    background: transparent;
    color: var(--inflo-accent);
    font-weight: 600;
}
.nav-link--child.active::after {
    content: '';
    position: absolute;
    left: 28px;
    top: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--inflo-accent);
    transform: translateY(-50%);
    box-shadow: 0 0 8px var(--inflo-accent);
}

/* İç içe alt menü (Anlaşmalar → 5 alt sayfa) */
.nav-sub { margin-bottom: 1px; }
.nav-sub-toggle .caret { margin-left: auto; }
.nav-sub-toggle .caret .inflo-icon {
    width: 14px; height: 14px;
    transition: transform 0.2s;
    color: rgba(255,255,255,0.4);
}
.nav-sub.open .nav-sub-toggle .caret .inflo-icon { transform: rotate(180deg); color: var(--inflo-accent); }
.nav-sub-toggle.has-active { color: var(--inflo-accent); }
.nav-sub-toggle.has-active .inflo-icon:not(.caret .inflo-icon) { color: var(--inflo-accent); }
.nav-sub-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
}
.nav-sub.open .nav-sub-body { max-height: 400px; }

/* Sidebar scrollbar */
.inflo-sidebar::-webkit-scrollbar { width: 6px; }
.inflo-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
.inflo-sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

.inflo-main { flex: 1; min-width: 0; }
.inflo-topbar {
    background: white;
    padding: 12px 24px;
    border-bottom: 1px solid #eef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.inflo-content { padding: 24px; }

/* Card */
.inflo-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(14,27,61,0.04);
    margin-bottom: 16px;
}
.inflo-card h1, .inflo-card h2, .inflo-card h3 { margin-top: 0; color: var(--inflo-primary); }

/* Buttons */
.inflo-btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 8px;
    background: #eef;
    color: var(--inflo-primary);
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.15s;
}
.inflo-btn:hover { background: #dde6f5; color: var(--inflo-primary); }
.inflo-btn-primary { background: var(--inflo-primary); color: white; }
.inflo-btn-primary:hover { background: #0a1530; color: white; }
.inflo-btn-accent { background: var(--inflo-accent); color: var(--inflo-primary); }
.inflo-btn-accent:hover { background: #00bcb4; }
.inflo-btn-danger { background: var(--inflo-coral); color: white; }
.inflo-btn-sm { padding: 4px 10px; font-size: 12px; }

/* Forms */
.inflo-form label { display: block; font-weight: 600; font-size: 13px; color: var(--inflo-primary); margin-top: 12px; }
.inflo-form input,
.inflo-form select,
.inflo-form textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d8def0;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 4px;
    font-family: inherit;
    background: white;
}
.inflo-form input:focus,
.inflo-form select:focus,
.inflo-form textarea:focus {
    outline: 2px solid var(--inflo-accent);
    border-color: var(--inflo-accent);
}
.inflo-form .help { font-size: 12px; color: var(--inflo-mist); margin-top: 4px; }
.inflo-form .error { color: var(--inflo-coral); font-size: 12px; margin-top: 4px; }

/* Tables */
.inflo-table { width: 100%; border-collapse: collapse; }
.inflo-table th, .inflo-table td { padding: 10px 12px; border-bottom: 1px solid #eef; text-align: left; }
.inflo-table th { font-size: 12px; text-transform: uppercase; color: var(--inflo-mist); letter-spacing: 0.04em; }
.inflo-table tbody tr:hover { background: #fafbfe; }

/* Badges */
.inflo-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.inflo-badge-pending  { background: #fef3c7; color: #92400e; }
.inflo-badge-approved { background: #d1fae5; color: #065f46; }
.inflo-badge-rejected { background: #fee2e2; color: #991b1b; }

/* Toast */
.inflo-toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
}
.inflo-toast {
    padding: 12px 16px; border-radius: 8px; background: white;
    box-shadow: 0 4px 16px rgba(14,27,61,0.15);
    min-width: 260px;
    border-left: 4px solid var(--inflo-mist);
    animation: inflo-toast-in 0.2s ease-out;
}
.inflo-toast.success { border-color: var(--inflo-mint); }
.inflo-toast.error   { border-color: var(--inflo-coral); }
.inflo-toast.warn    { border-color: #f59e0b; }
@keyframes inflo-toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Loading overlay */
.inflo-loading-overlay {
    position: fixed; inset: 0; background: rgba(14,27,61,0.4);
    display: none; align-items: center; justify-content: center;
    z-index: 9998;
}
.inflo-loading-overlay.show { display: flex; }
.inflo-spinner {
    width: 48px; height: 48px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: var(--inflo-accent);
    border-radius: 50%;
    animation: inflo-spin 0.8s linear infinite;
}
@keyframes inflo-spin { to { transform: rotate(360deg); } }

/* Auth pages */
.inflo-auth { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 24px; }
.inflo-auth-card { background: white; padding: 40px; border-radius: 16px; width: 100%; max-width: 420px; box-shadow: 0 8px 32px rgba(14,27,61,0.08); }
.inflo-auth-card .logo { font-size: 32px; font-weight: 700; color: var(--inflo-primary); text-align: center; margin-bottom: 4px; }
.inflo-auth-card .logo .dot { color: var(--inflo-accent); }
.inflo-auth-card .tagline { text-align: center; color: var(--inflo-mist); font-size: 13px; margin-bottom: 24px; }

/* Errors */
.inflo-flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.inflo-flash-error { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--inflo-coral); }
.inflo-flash-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--inflo-mint); }

/* ─────────────────────────────────────────────
   MOBİL UYUMLULUK
   ───────────────────────────────────────────── */

/* Sidebar toggle butonu (hamburger) */
.inflo-mobile-toggle {
    display: none;
    background: var(--inflo-primary);
    color: white;
    border: 0;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Sidebar backdrop (mobil overlay) */
.inflo-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(14,27,61,0.55);
    z-index: 99;
    backdrop-filter: blur(2px);
}
.inflo-sidebar-backdrop.show { display: block; }

@media (max-width: 768px) {
    /* Sidebar gizle, hamburger butonu göster */
    .inflo-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 100;
        height: 100vh;
        width: 280px;
        min-width: 280px;
        max-width: 280px;
    }
    .inflo-sidebar.open { transform: translateX(0); box-shadow: 8px 0 30px rgba(0,0,0,0.3); }

    .inflo-mobile-toggle { display: inline-flex; margin-right: 12px; }
    .inflo-main { width: 100%; min-width: 0; }
    .inflo-content { padding: 12px; }
    .inflo-topbar { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
    .inflo-topbar strong { font-size: 15px; }

    /* Sayfa başlığı küçült */
    .inflo-content h1 { font-size: 20px !important; }
    .inflo-content h1 svg { width: 22px !important; height: 22px !important; }

    /* Card padding düşür */
    .inflo-card { padding: 16px; border-radius: 10px; }

    /* Tablolar artık kart görünümü olarak göster — `.responsive-card` class'lı tablolarda */
    table.responsive-card { display: block; background: transparent; box-shadow: none; }
    table.responsive-card thead { display: none; }
    table.responsive-card tbody { display: block; }
    table.responsive-card tr {
        display: block;
        background: white;
        border-radius: 10px;
        padding: 12px 14px;
        margin-bottom: 10px;
        box-shadow: 0 1px 3px rgba(14,27,61,0.06);
        border-bottom: 0 !important;
    }
    table.responsive-card td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 6px 0 !important;
        border-bottom: 1px solid #f1f5f9 !important;
        font-size: 13px;
        text-align: left !important;
    }
    table.responsive-card td:last-child { border-bottom: 0 !important; }
    table.responsive-card td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #475569;
        text-transform: uppercase;
        font-size: 11px;
        letter-spacing: 0.04em;
        flex-shrink: 0;
        min-width: 90px;
    }

    /* Forms: tek kolon */
    .row.g-3 { row-gap: 12px !important; }

    /* Form button hizasını sağa al */
    .pf-actions, .st-actions { flex-direction: column-reverse; gap: 8px !important; }
    .pf-actions .inflo-btn, .st-actions .inflo-btn { width: 100%; justify-content: center; }

    /* Filter grid'leri tek kolon */
    .i-filter, .p-filter, .st-filter, .sl-filter form, .b-card { grid-template-columns: 1fr !important; }
    .b-grid, .p-grid { grid-template-columns: 1fr !important; }
    .st-stats, .sl-summary, .i-stats, .p-stats, .b-stats, .c-stats, .s-stats { grid-template-columns: repeat(2, 1fr) !important; }

    /* Tablo overflow için ekstra yatay scroll */
    .table-scroll-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Aksiyon butonları daha kompakt */
    .i-acts, .b-actions, .s-tbl .i-acts, .c-acts { gap: 4px; }
    .i-act, .b-act, .s-act, .p-act-btn { width: 30px; height: 30px; }

    /* Modal daha geniş */
    .b-modal-box, .c-modal-box, .s-modal-box, .st-modal-box, .i-modal-box { max-width: 100% !important; margin: 0; border-radius: 12px 12px 0 0; max-height: 95vh; }
    .b-modal, .c-modal, .s-modal, .st-modal, .i-modal { align-items: flex-end; padding: 0; }
}

@media (max-width: 480px) {
    .st-stats, .sl-summary, .i-stats, .p-stats, .b-stats, .c-stats, .s-stats { grid-template-columns: 1fr !important; }
    .i-stat-v, .p-stat-v, .b-stat-v, .s-stat-v { font-size: 24px !important; }
}
