html {
    font-size: 14px;
    height: 100%;
}

@media (min-width: 768px) {
    html { font-size: 16px; }
}

:root {
    --ascom-ink: #111827;
    --ascom-muted: #667085;
    --ascom-border: #e3e8ef;
    --ascom-panel: #ffffff;
    --ascom-page: #f5f7fa;
    --ascom-sidebar: #0f172a;
    --ascom-sidebar-2: #172033;
    --ascom-sidebar-line: rgba(255, 255, 255, 0.10);
    --ascom-accent: #10b981;
    --ascom-accent-2: #2dd4bf;
    --ascom-blue: #2f6fed;
    --ascom-amber: #c47a18;
    --ascom-danger: #c43e48;
    --ascom-radius: 8px;
    --ascom-shadow: 0 16px 42px rgba(17, 24, 39, 0.10);
    --ascom-shadow-soft: 0 8px 24px rgba(17, 24, 39, 0.06);
}

body {
    height: 100%;
    margin: 0;
    padding: 0;
    color: var(--ascom-ink);
    background: var(--ascom-page);
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    overflow: hidden;
}

a { color: var(--ascom-blue); }

/* App shell */
#wrapper {
    display: flex;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    background: var(--ascom-page);
}

.sidebar {
    width: 256px;
    height: 100vh;
    position: sticky;
    top: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--ascom-sidebar);
    border-right: 1px solid var(--ascom-sidebar-line);
    box-shadow: 12px 0 34px rgba(15, 23, 42, 0.16);
    transition: width 0.2s ease, transform 0.2s ease;
}

.sidebar.collapsed {
    width: 0;
    border-right: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 78px;
    padding: 1.1rem 1rem;
    color: #fff;
    border-bottom: 1px solid var(--ascom-sidebar-line);
}

.sidebar-header h5 {
    color: #fff;
    font-size: 1.05rem;
    letter-spacing: 0.03em;
}

.sidebar-header small {
    color: #9aa8ba;
    font-size: 0.76rem;
}

.sidebar-account {
    margin: 0.75rem 0.75rem 0;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--ascom-radius);
    background: rgba(255, 255, 255, 0.045);
}

.sidebar-account span {
    display: block;
    margin-bottom: 0.2rem;
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-account strong {
    display: block;
    overflow: hidden;
    color: #e5eefb;
    font-size: 0.78rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--ascom-sidebar);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
    letter-spacing: 0;
}

.nav-section {
    margin: 1rem 0 0.35rem;
    padding: 0 0.65rem;
}

.nav-section small {
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.nav-icon {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin-right: 0.65rem;
    flex: 0 0 26px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    font-size: 0.88rem;
}

.sidebar-nav {
    padding: 0.85rem 0.75rem;
    margin: 0;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0.52rem 0.65rem;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: var(--ascom-radius);
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.075);
    color: #fff;
    transform: translateX(1px);
}

.sidebar-link.active {
    background: #f8fafc;
    color: var(--ascom-sidebar);
    font-weight: 650;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.sidebar-link.active .nav-icon {
    background: var(--ascom-accent);
    color: #042016;
}

.sidebar-actions {
    margin-top: auto;
    width: 100%;
    padding: 0.75rem;
    border-top: 1px solid var(--ascom-sidebar-line);
    background: rgba(2, 6, 23, 0.24);
}

#content-wrapper {
    min-width: 0;
    height: 100vh;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-topbar {
    min-height: 64px;
    flex: 0 0 auto;
    padding: 0.75rem 1.35rem;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid var(--ascom-border);
    box-shadow: 0 1px 0 rgba(17, 24, 39, 0.04);
}

.sidebar-toggle {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid #d8e0ea;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    line-height: 1;
}

.sidebar-toggle:hover {
    background: #f8fafc;
}

.page-title {
    color: var(--ascom-ink);
    font-size: 1rem;
    font-weight: 750;
}

.user-chip {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0.38rem 0.65rem;
    border: 1px solid var(--ascom-border);
    border-radius: 999px;
    background: #f8fafc;
    color: #475467;
    font-size: 0.8rem;
    font-weight: 600;
}

.topbar-logout {
    background: #fff;
}

main {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.65rem;
}

main > .alert {
    border-radius: var(--ascom-radius);
    border: 0;
    box-shadow: var(--ascom-shadow);
}

/* Bootstrap polish */
.card {
    border: 1px solid var(--ascom-border);
    border-radius: var(--ascom-radius);
    box-shadow: var(--ascom-shadow-soft);
    background: rgba(255, 255, 255, 0.98);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--ascom-border);
    font-weight: 650;
}

.btn {
    border-radius: var(--ascom-radius);
    font-weight: 600;
}

.btn-dark {
    background: var(--ascom-ink);
    border-color: var(--ascom-ink);
    box-shadow: 0 6px 16px rgba(17, 24, 39, 0.14);
}

.btn-outline-secondary {
    border-color: #c8d1dc;
    color: #415066;
}

.form-control,
.form-select {
    border-color: #cfd8e3;
    border-radius: var(--ascom-radius);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--ascom-accent);
    box-shadow: 0 0 0 0.2rem rgba(31, 138, 112, 0.14);
}

.table {
    --bs-table-hover-bg: rgba(31, 138, 112, 0.055);
}

.table-light {
    --bs-table-bg: #f1f5f9;
    color: #405064;
}

.list-group-item {
    border-color: var(--ascom-border);
}

.list-group-item-action:hover {
    background: #f5f8fb;
}

.nav-tabs {
    border-bottom-color: var(--ascom-border);
}

.nav-tabs .nav-link {
    color: var(--ascom-muted);
    border-radius: var(--ascom-radius) var(--ascom-radius) 0 0;
}

.nav-tabs .nav-link.active {
    color: var(--ascom-ink);
    font-weight: 650;
    border-color: var(--ascom-border) var(--ascom-border) #fff;
}

.accordion-item {
    border: 1px solid var(--ascom-border);
    border-radius: var(--ascom-radius) !important;
    overflow: hidden;
}

.accordion-button {
    background: #fff;
    color: var(--ascom-ink);
}

.accordion-button:not(.collapsed) {
    color: var(--ascom-ink);
    background: #ecfdf5;
    box-shadow: inset 0 -1px 0 var(--ascom-border);
}

/* Mail akış kartları */
.mail-kart {
    border-radius: var(--ascom-radius);
    padding: 12px 14px;
    margin-bottom: 8px;
    border-left: 4px solid transparent;
    background: #fff;
}

.mail-kart.gelen { border-left-color: var(--ascom-blue); }
.mail-kart.giden { border-left-color: var(--ascom-accent); }

.mail-html-frame {
    display: block;
    width: 100%;
    min-height: 320px;
    border: 1px solid var(--ascom-border);
    border-radius: var(--ascom-radius);
    background: #fff;
}

.mail-text-content {
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: normal;
    font-family: inherit;
    font-size: 0.875rem;
    background: #f8fafc;
    padding: 12px;
    border: 1px solid var(--ascom-border);
    border-radius: var(--ascom-radius);
}

.mail-attachments .btn {
    background: #fff;
}

/* Liste tonları: sadece ayırt edilecek kadar hafif */
.inactive-list-card {
    border-color: #f1d8dc;
}

.inactive-list-card .card-header {
    color: #8f2d38;
    background: #fff7f8;
    border-bottom-color: #f3dfe2;
}

.inactive-list .list-group-item,
.inactive-list .musteri-mobile-card,
.inactive-list .customer-list-table tbody tr {
    background-color: #fffafa !important;
}

.inactive-list .list-group-item:nth-child(even),
.inactive-list .musteri-mobile-card:nth-child(even),
.inactive-list .customer-list-table tbody tr:nth-child(even) {
    background-color: #fff4f5 !important;
}

.inactive-list .list-group-item:hover,
.inactive-list .musteri-mobile-card:hover,
.inactive-list .customer-list-table tbody tr:hover > * {
    background-color: #ffeff1 !important;
}

.customer-list .musteri-mobile-card,
.customer-list .customer-list-table tbody tr {
    background-color: #ffffff !important;
}

.customer-list .musteri-mobile-card:nth-child(even),
.customer-list .customer-list-table tbody tr:nth-child(even) {
    background-color: #f8fafc !important;
}

.customer-list .musteri-mobile-card:hover,
.customer-list .customer-list-table tbody tr:hover > * {
    background-color: #f3f6f9 !important;
}

.customer-list-table tbody tr > * {
    background-color: transparent !important;
}

.mail-list-card {
    border-color: #dce8f7;
}

.mail-list-card .card-header {
    color: #255a92;
    background: #f8fbff;
    border-bottom-color: #e2edf9;
}

.mail-list .list-group-item,
.mail-list .mail-kart {
    background-color: #ffffff !important;
}

.mail-list .list-group-item:nth-child(even),
.mail-list .mail-kart:nth-child(even) {
    background-color: #f7fbff !important;
}

.mail-list .list-group-item:hover,
.mail-list .mail-kart:hover {
    background-color: #f1f7ff !important;
}

.offer-list-card {
    border-color: #dce8f7;
}

.offer-list-card .card-header {
    color: #255a92;
    background: #f8fbff;
    border-bottom-color: #e2edf9;
}

.offer-list .list-group-item,
.offer-list .musteri-mobile-card,
.offer-list .customer-list-table tbody tr {
    background-color: #ffffff !important;
}

.offer-list .list-group-item:nth-child(even),
.offer-list .musteri-mobile-card:nth-child(even),
.offer-list .customer-list-table tbody tr:nth-child(even) {
    background-color: #f7fbff !important;
}

.offer-list .list-group-item:hover,
.offer-list .musteri-mobile-card:hover,
.offer-list .customer-list-table tbody tr:hover > * {
    background-color: #edf8ff !important;
}

.dashboard-stat-card {
    position: relative;
    overflow: hidden;
    color: inherit;
    border-color: transparent !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.dashboard-stat-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--ascom-accent);
}

.dashboard-stat-card.border-success::before { background: var(--ascom-accent); }
.dashboard-stat-card.border-warning::before { background: var(--ascom-amber); }
.dashboard-stat-card.border-danger::before { background: var(--ascom-danger); }
.dashboard-stat-card.border-info::before { background: #2b6f9a; }

.dashboard-stat-card .fs-1 {
    font-size: clamp(2rem, 4vw, 2.65rem) !important;
    line-height: 1;
}

.dashboard-stat-card:hover,
.dashboard-stat-card:focus {
    color: inherit;
    transform: translateY(-2px);
    box-shadow: var(--ascom-shadow);
}

.musteri-mobile-list {
    display: none;
}

.customer-detail-title {
    min-width: 0;
}

.customer-detail-title small {
    display: block;
    overflow-wrap: anywhere;
}

.customer-detail-actions {
    flex-shrink: 0;
    align-items: center;
}

.customer-detail-actions .btn {
    white-space: nowrap;
}

.activity-log-list {
    display: grid;
    gap: 0.75rem;
}

.activity-log-item {
    display: grid;
    grid-template-columns: 14px 1fr;
    gap: 0.75rem;
}

.activity-log-marker {
    width: 10px;
    height: 10px;
    margin-top: 0.55rem;
    border-radius: 999px;
    background: var(--ascom-accent);
    box-shadow: 0 0 0 4px rgba(43, 111, 154, 0.12);
}

.activity-log-content {
    padding: 0.85rem 1rem;
    border: 1px solid var(--ascom-border);
    border-radius: var(--ascom-radius);
    background: #fff;
    box-shadow: 0 0.35rem 0.9rem rgba(31, 42, 55, 0.04);
}

.activity-log-detail {
    margin-top: 0.5rem;
    color: #344054;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.activity-log-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.85rem;
    margin-top: 0.55rem;
    color: var(--ascom-muted);
    font-size: 0.82rem;
}

.global-log-search {
    width: min(100%, 520px);
}

.global-log-search .form-control {
    min-width: min(320px, 50vw);
}

.global-activity-log {
    max-width: 980px;
}

/* Durum badge'leri */
.durum-Yeni { background-color: #667085; }
.durum-Iletisimde { background-color: #2b9fb8; color: #fff; }
.durum-TeklifGonderildi { background-color: #2563eb; }
.durum-Sicak { background-color: #c56a1a; }
.durum-OdemeBekleniyor { background-color: #d8a20f; color: #151515; }
.durum-OlumsuzDonusYapmadi { background-color: #c24145; }
.durum-Basarili { background-color: #1f8a70; }
.durum-Olumsuz { background-color: #343a40; }
.durum-CevapBekleniyor { background-color: #0f766e; color: #fff; }

/* Responsive */
@media (max-width: 768px) {
    body { overflow: hidden; }

    #wrapper {
        height: 100vh;
        min-height: 100vh;
    }

    .sidebar {
        width: 0;
        position: fixed;
        z-index: 1000;
        transform: translateX(-100%);
    }

    .sidebar.open {
        width: 256px;
        transform: translateX(0);
        box-shadow: 12px 0 28px rgba(20, 32, 46, 0.28);
    }

    .sidebar.collapsed {
        width: 0;
    }

    .sidebar:not(.open) #pwaInstallBtn,
    .sidebar:not(.open) #pushEnableBtn {
        position: fixed !important;
        left: 10px;
        width: 180px !important;
        z-index: 1050;
    }

    .sidebar:not(.open) #pwaInstallBtn { bottom: 62px; }
    .sidebar:not(.open) #pushEnableBtn { bottom: 16px; }

    .sidebar:not(.open) #pwaInstallBtn .btn {
        background: var(--ascom-sidebar);
        border-color: var(--ascom-sidebar);
        color: #fff;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.16);
    }

    .sidebar:not(.open) #pushEnableBtn .btn {
        background: #fff;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12);
    }

    .app-topbar {
        min-height: 56px;
        padding: 0.6rem 0.875rem;
    }

    main {
        padding: 1rem !important;
        padding-bottom: 7.5rem !important;
    }

    .musteri-header {
        align-items: flex-start !important;
    }

    .musteri-header .btn {
        flex-shrink: 0;
    }

    .customer-detail-header {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .customer-detail-title h5 {
        font-size: 1rem;
        line-height: 1.25;
    }

    .customer-detail-title small {
        font-size: 0.86rem;
        line-height: 1.55;
    }

    .customer-detail-actions {
        display: grid !important;
        grid-template-columns: auto 1fr 1fr;
        width: 100%;
        gap: 0.5rem !important;
        align-items: stretch;
    }

    .customer-detail-actions .badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 38px;
        padding-inline: 0.75rem;
        white-space: nowrap;
    }

    .customer-detail-actions form {
        display: flex !important;
        min-width: 0;
    }

    .customer-detail-actions .btn {
        width: 100%;
        min-height: 38px;
        white-space: nowrap;
    }

    .musteri-filter-form .row {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .musteri-search-col {
        grid-column: 1 / -1;
    }

    .musteri-filter-col,
    .musteri-action-col {
        width: 100%;
    }

    .musteri-filter-form .form-control,
    .musteri-filter-form .form-select,
    .musteri-filter-form .btn {
        width: 100%;
        min-height: 40px;
    }

    .musteri-action-col {
        display: flex;
        gap: 0.5rem;
    }

    .musteri-action-col .btn-outline-danger {
        width: auto;
        min-width: 42px;
        margin-left: 0 !important;
    }

    .musteri-desktop-table {
        display: none;
    }

    .musteri-mobile-list {
        display: grid;
        gap: 0.75rem;
    }

    .musteri-mobile-card {
        display: block;
        padding: 0.875rem;
        border: 1px solid var(--ascom-border);
        border-left: 4px solid var(--ascom-accent);
        border-radius: var(--ascom-radius);
        background: #fff;
        color: inherit;
        text-decoration: none;
        box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.04);
    }

    .musteri-mobile-card:active,
    .musteri-mobile-card:hover,
    .musteri-mobile-card:focus {
        color: inherit;
        border-color: #cad5e0;
        text-decoration: none;
    }

    .musteri-mobile-meta {
        color: var(--ascom-muted);
        font-size: 0.875rem;
        overflow-wrap: anywhere;
    }

    .musteri-mobile-detail {
        color: var(--ascom-accent);
        font-size: 0.875rem;
        font-weight: 650;
    }

    .accordion-button {
        align-items: flex-start;
    }

    .accordion-button .d-flex {
        flex-direction: column;
        gap: 4px;
    }

    .accordion-body {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .mail-kart {
        padding: 8px;
    }

    .mail-html-frame {
        min-height: 420px;
    }

    .global-log-search {
        width: 100%;
        display: grid !important;
        grid-template-columns: 1fr auto auto;
    }

    .global-log-search .form-control {
        min-width: 0;
    }
}
