:root {
    --bum-sidebar: #1a2332;
    --bum-sidebar-hover: #243044;
    --bum-accent: #0d9488;
    --bum-accent-soft: #ccfbf1;
    --bum-bg: #eef2f6;
    --bum-surface: #ffffff;
    --bum-text: #1e293b;
    --bum-muted: #64748b;
    --bum-border: #e2e8f0;
    --bum-sidebar-w: 240px;
    --bum-radius: 12px;
    --font-ui: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    font-family: var(--font-ui);
    color: var(--bum-text);
    background: var(--bum-bg);
}

/* —— Shell —— */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--bum-sidebar-w);
    flex-shrink: 0;
    background: linear-gradient(180deg, #1a2332 0%, #151c28 100%);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 1030;
}

.app-brand {
    padding: 1.15rem 1.1rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.app-brand-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: #fff;
    text-decoration: none;
}

.app-brand-link:hover {
    color: #fff;
}

.app-brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(255,255,255,.08);
}

.app-brand-metin {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.app-brand-baslik {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -.02em;
    line-height: 1.2;
}

.app-brand small {
    display: block;
    color: #94a3b8;
    font-size: .72rem;
    font-weight: 400;
}

.app-topbar-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
}

.login-logo {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .12);
}

.app-nav {
    padding: .75rem .65rem;
    flex: 1;
}

.app-nav a {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .7rem .85rem;
    border-radius: 10px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: .92rem;
    font-weight: 500;
    margin-bottom: .25rem;
    transition: background .15s, color .15s;
}

.app-nav a.app-nav-alt {
    margin-left: .55rem;
    padding-left: .85rem;
    font-size: .88rem;
    opacity: .95;
}
.app-nav a.active {
    background: rgba(13, 148, 136, .22);
    color: #5eead4;
}

.app-sidebar-foot {
    padding: 1rem 1.15rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: .8rem;
    color: #94a3b8;
}

.app-sidebar-foot .btn-cikis {
    width: 100%;
    margin-top: .65rem;
    border: 1px solid rgba(255,255,255,.18);
    color: #e2e8f0;
    background: transparent;
    border-radius: 8px;
    padding: .4rem .75rem;
}
.app-sidebar-foot .btn-cikis:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-topbar {
    display: none;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    background: var(--bum-surface);
    border-bottom: 1px solid var(--bum-border);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-content {
    flex: 1;
    padding: 1rem 1.25rem 0.75rem;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* —— Mail workspace —— */
.mail-workspace {
    display: grid;
    grid-template-columns: minmax(340px, 42%) 1fr;
    gap: 1rem;
    flex: 1;
    height: calc(100vh - 1.75rem);
    max-height: calc(100vh - 1.75rem);
    min-height: 420px;
    margin-bottom: 0.5rem; /* ~1 parmak alt boşluk */
}

.mail-pane {
    background: var(--bum-surface);
    border-radius: var(--bum-radius);
    border: 1px solid var(--bum-border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.mail-pane-head {
    padding: 1rem 1.15rem .75rem;
    border-bottom: 1px solid var(--bum-border);
    flex-shrink: 0;
}

.mail-domain-secimler {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem .75rem;
    padding: .85rem 1.15rem;
    border-bottom: 1px solid var(--bum-border);
    background: #fff;
    flex-shrink: 0;
}

.mail-domain-secim {
    flex: 1 1 180px;
    min-width: 160px;
    max-width: 280px;
}

.mail-domain-etiket {
    display: block;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: .25rem;
}

.mail-pane-head .mail-read-hesap {
    margin: 0;
    min-width: 0;
}

.tum-ara-modal .modal-body {
    max-height: min(78vh, 820px);
    padding: .75rem 1.1rem 1.1rem;
}

.tum-ara-modal .mail-read-icerik {
    min-height: 0;
}

.tum-ara-modal .govde-iframe {
    min-height: 420px;
    height: 52vh;
}

.mail-icerik-ara {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin: 0;
    padding: .28rem .7rem;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    font-size: .78rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: border-color .15s, color .15s, background .15s;
}

.mail-icerik-ara input {
    width: .9rem;
    height: .9rem;
    margin: 0;
    accent-color: var(--bum-accent);
    cursor: pointer;
}

.mail-icerik-ara:hover {
    border-color: #99f6e4;
    color: #0f766e;
}

.mail-icerik-ara.aktif {
    border-color: rgba(13, 148, 136, .35);
    background: rgba(13, 148, 136, .08);
    color: #0f766e;
}

.mail-liste {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.mail-item {
    display: grid;
    grid-template-columns: 8px 1fr auto;
    gap: .35rem 0.75rem;
    padding: .85rem 1rem .85rem .65rem;
    border-bottom: 1px solid var(--bum-border);
    cursor: pointer;
    transition: background .12s;
    text-decoration: none;
    color: inherit;
}

.mail-item:hover { background: #f1f5f9; }
.mail-item.secili {
    background: var(--bum-accent-soft);
    box-shadow: inset 3px 0 0 var(--bum-accent);
}
.mail-item.okunmamis .mail-item-konu { font-weight: 700; }
.mail-item.okunmamis .mail-item-gonderen { font-weight: 600; }

.mail-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: .45rem;
    background: transparent;
}
.mail-item.okunmamis .mail-item-dot { background: var(--bum-accent); }

.mail-item-gonderen {
    font-size: .9rem;
    color: var(--bum-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mail-item-konu {
    font-size: .88rem;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mail-item-meta {
    font-size: .75rem;
    color: var(--bum-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mail-item-tarih {
    font-size: .75rem;
    color: var(--bum-muted);
    text-align: right;
    white-space: nowrap;
}

.mail-read {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    height: 100%;
}
.mail-read-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bum-muted);
    text-align: center;
    padding: 2rem;
}
.mail-read-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1rem 1.15rem 0.75rem;
    min-height: 0;
}

.mail-read-icerik {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.mail-read-ust {
    flex-shrink: 0;
    max-height: 38%;
    overflow: auto;
    margin-bottom: .65rem;
}

.mail-govde-alan {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.mail-read-konu {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin: 0 0 .65rem;
}

.mail-read-hesap {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    max-width: 100%;
    margin: 0 0 .5rem;
    padding: .35rem .7rem .35rem .35rem;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(13, 148, 136, .12), rgba(13, 148, 136, .05));
    border: 1px solid rgba(13, 148, 136, .28);
    color: #0f766e;
    font-size: .82rem;
}

.mail-read-hesap-etiket {
    flex-shrink: 0;
    padding: .15rem .55rem;
    border-radius: 999px;
    background: var(--bum-accent);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.mail-read-hesap-adres {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.mail-read-meta {
    font-size: .85rem;
    color: var(--bum-muted);
    display: grid;
    gap: .3rem;
    margin-bottom: .75rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--bum-border);
}
.mail-read-meta strong { color: #475569; font-weight: 600; }

.govde-metin {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.govde-iframe {
    width: 100%;
    flex: 1;
    min-height: 0;
    height: 100%;
    border: 1px solid var(--bum-border);
    border-radius: 8px;
    background: #fff;
}

.badge-ek {
    background: #e0f2fe;
    color: #0369a1;
    font-weight: 600;
    font-size: .7rem;
}

.mail-detay-sayfa {
    flex: 1;
    height: calc(100vh - 5.5rem);
    max-height: calc(100vh - 5.5rem);
    margin-bottom: 0.75rem;
}

.btn-accent {
    background: var(--bum-accent);
    border-color: var(--bum-accent);
    color: #fff;
}
.btn-accent:hover,
.btn-accent:focus {
    background: #0f766e;
    border-color: #0f766e;
    color: #fff;
}
.btn-accent:disabled,
.btn-accent.disabled {
    background: var(--bum-accent);
    border-color: var(--bum-accent);
    color: #fff;
    opacity: .55;
}

/* Sayfa başlığı sağ üst aksiyon — açık gri hap buton (proje kuralı) */
.sayfa-ust-aksiyonlar .btn,
.btn.sayfa-ust-aksiyon,
.btn.btn-ust-aksiyon {
    border-radius: 999px !important;
    padding: 0.45rem 1.2rem !important;
    font-weight: 600;
    background-color: #75ffa6 !important;
    background-image: none !important;
    border: 1px solid #4ade80 !important;
    color: #1e293b !important;
    box-shadow: none !important;
    line-height: 1.35;
}
.sayfa-ust-aksiyonlar .btn:hover,
.sayfa-ust-aksiyonlar .btn:focus,
.btn.sayfa-ust-aksiyon:hover,
.btn.sayfa-ust-aksiyon:focus,
.btn.btn-ust-aksiyon:hover,
.btn.btn-ust-aksiyon:focus {
    background-color: #5ee890 !important;
    background-image: none !important;
    border-color: #22c55e !important;
    color: #0f172a !important;
}
.sayfa-ust-aksiyonlar .btn:disabled,
.sayfa-ust-aksiyonlar .btn.disabled,
.btn.btn-ust-aksiyon:disabled,
.btn.btn-ust-aksiyon.disabled {
    background-color: #75ffa6 !important;
    background-image: none !important;
    border-color: #4ade80 !important;
    color: #64748b !important;
    opacity: 0.65;
}

/* Domain satırı: + Mail Adresi her zaman dolu accent */
.domain-aksiyonlar .btn-accent {
    background: var(--bum-accent);
    border-color: var(--bum-accent);
    color: #fff;
}

.pagination .page-link {
    color: var(--bum-accent);
    border-radius: 8px;
    margin: 0 .15rem;
}
.pagination .page-item.active .page-link {
    background: var(--bum-accent);
    border-color: var(--bum-accent);
    color: #fff;
}
.pagination .page-item.active .page-link:hover,
.pagination .page-item.active .page-link:focus {
    background: #0f766e;
    border-color: #0f766e;
    color: #fff;
}

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at top left, rgba(13,148,136,.18), transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(30,41,59,.12), transparent 45%),
        var(--bum-bg);
    padding: 1.5rem;
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bum-surface);
    border-radius: 16px;
    border: 1px solid var(--bum-border);
    box-shadow: 0 12px 40px rgba(15, 23, 42, .08);
    padding: 2rem 1.75rem;
}

#toast-container.toast-top-center { top: 12px; left: 50%; transform: translateX(-50%); }
@media (min-width: 769px) {
    #toast-container.toast-top-center { width: 40%; }
}
@media (max-width: 768px) {
    #toast-container.toast-top-center { width: 90%; }
}

/* —— Hesap yönetimi —— */
.yonetim-ust {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.yonetim-baslik {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 .35rem;
    letter-spacing: -.02em;
}
.yonetim-aciklama {
    color: var(--bum-muted);
    font-size: .9rem;
    max-width: 42rem;
}
.yonetim-ozet-kart {
    background: var(--bum-surface);
    border: 1px solid var(--bum-border);
    border-radius: var(--bum-radius);
    padding: 1rem 1.15rem;
}
.yonetim-ozet-kart .etiket {
    font-size: .75rem;
    color: var(--bum-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
}
.yonetim-ozet-kart .deger {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--bum-accent);
    line-height: 1.2;
    margin-top: .2rem;
}
.yonetim-ozet-kart .kota-max {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bum-muted);
}
.yonetim-bos {
    background: var(--bum-surface);
    border: 1px dashed var(--bum-border);
    border-radius: var(--bum-radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
}
.yonetim-domain {
    background: var(--bum-surface);
    border: 1px solid var(--bum-border);
    border-radius: var(--bum-radius);
    margin-bottom: 1rem;
    overflow: hidden;
}
.yonetim-domain.pasif { opacity: .78; }
.yonetim-domain-baslik {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--bum-border);
    background: linear-gradient(180deg, #f8fafc, #fff);
}
.yonetim-domain-meta {
    margin-top: .35rem;
    font-size: .82rem;
    color: var(--bum-muted);
}
.yonetim-hesap-bos {
    padding: 1rem 1.15rem;
    color: var(--bum-muted);
    font-size: .9rem;
}
.yonetim-hesap-tablo {
    font-size: .88rem;
}
.yonetim-hesap-tablo th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--bum-muted);
    font-weight: 600;
    background: #f8fafc;
}
.yonetim-hesap-tablo td,
.yonetim-hesap-tablo th {
    padding: .7rem 1rem;
    vertical-align: middle;
}
.yonetim-form-wrap {
    max-width: 640px;
}
.yonetim-form {
    background: var(--bum-surface);
    border: 1px solid var(--bum-border);
    border-radius: var(--bum-radius);
    padding: 1.35rem 1.25rem;
}

/* —— Responsive —— */
@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 8px 0 24px rgba(0,0,0,.2);
    }
    .app-sidebar.acik { transform: translateX(0); }
    .app-topbar { display: flex; }
    .app-content { padding: .75rem; }
    .mail-workspace {
        grid-template-columns: 1fr;
        height: auto;
        max-height: none;
        min-height: calc(100vh - 5rem);
        margin-bottom: 0.75rem;
    }
    .mail-read-pane { display: none !important; }
    .mail-list-pane { height: calc(100vh - 5rem); }
    .govde-iframe {
        min-height: calc(100vh - 12rem);
        height: calc(100vh - 12rem);
        flex: none;
    }
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, .45);
        z-index: 1025;
    }
    .sidebar-backdrop.acik { display: block; }
}
