/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --navy:       #1a2b4a;
    --navy-dark:  #142039;
    --navy-light: #243552;
    --blue:       #2c5f9e;
    --blue-hover: #245190;
    --blue-light: #e8f0fb;
    --accent:     #3b82f6;
    --text-dark:  #1e2a3a;
    --text-mid:   #4a5568;
    --text-light: #8898aa;
    --border:     #e2e8f0;
    --border-mid: #cbd5e0;
    --bg:         #f0f4f8;
    --bg-white:   #ffffff;
    --bg-hover:   #f7fafc;
    --red:        #e53e3e;
    --green:      #38a169;
    --yellow:     #d69e2e;
    --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
    --shadow-md:  0 4px 12px rgba(0,0,0,.1);
    --shadow-lg:  0 8px 30px rgba(0,0,0,.15);
    --radius:     8px;
    --sidebar-w:  240px;
    --list-w:     380px;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    color: var(--text-dark);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* ===== Login Page ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a2b4a 0%, #2c5f9e 50%, #1a3a6e 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}

.login-logo {
    text-align: center;
    color: white;
    margin-bottom: 32px;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.login-logo p {
    font-size: 13px;
    opacity: 0.7;
    margin-top: 4px;
}

.login-card {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 36px 40px;
    box-shadow: var(--shadow-lg);
}

.login-card h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 24px;
}

.login-form .form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-mid);
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border-mid);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-dark);
    background: var(--bg-white);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.form-group input:disabled {
    background: var(--bg);
    color: var(--text-light);
    cursor: not-allowed;
}

.input-with-icon {
    position: relative;
}

.input-with-icon input { padding-right: 44px; }

.toggle-pass {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    display: flex;
}

.toggle-pass:hover { color: var(--text-mid); }

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    background: var(--blue);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .1s;
}

.btn-primary:hover { background: var(--blue-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-full { width: 100%; justify-content: center; padding: 13px; }

.btn-text {
    background: none;
    border: none;
    color: var(--text-mid);
    cursor: pointer;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: var(--radius);
}
.btn-text:hover { background: var(--bg-hover); }

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 13px;
    padding: 0;
}
.btn-link:hover { text-decoration: underline; }

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    color: #c53030;
}

.login-footer {
    text-align: center;
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    margin-top: 20px;
}

/* ===== Mail Page Layout ===== */
.mail-page {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--navy);
    color: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width .25s, min-width .25s;
    z-index: 100;
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
}

.sidebar-header {
    padding: 20px 16px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.sidebar-compose {
    padding: 16px;
}

.btn-compose {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px;
    background: rgba(255,255,255,0.12);
    color: white;
    border: 1.5px solid rgba(255,255,255,0.2);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

.btn-compose:hover {
    background: rgba(255,255,255,0.2);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.nav-folder {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    color: rgba(255,255,255,0.75);
    font-size: 12.5px;
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.nav-folder:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-folder.active { background: rgba(255,255,255,0.15); color: white; font-weight: 600; }

.nav-folder .folder-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.nav-folder .folder-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-folder .folder-count {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.65);
    background: rgba(255,255,255,0.1);
    padding: 1px 6px;
    border-radius: 8px;
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
}
.nav-folder.active .folder-count {
    color: white;
    background: rgba(255,255,255,0.2);
}
.nav-folder .folder-badge {
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.nav-loading {
    padding: 20px;
    display: flex;
    justify-content: center;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    overflow: hidden;
}

.user-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-actions {
    display: flex;
    gap: 4px;
}

/* ===== Disk Usage Bar ===== */
.disk-usage {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
}

.disk-usage-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 7px;
    color: rgba(255,255,255,0.6);
}

.disk-label {
    flex: 1;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.disk-pct {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.disk-bar-track {
    height: 4px;
    background: rgba(255,255,255,0.12);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.disk-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width .6s ease;
}

.disk-sizes {
    display: flex;
    justify-content: space-between;
    font-size: 10.5px;
    color: rgba(255,255,255,0.4);
}

.icon-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    color: var(--text-mid);
    transition: background .15s, color .15s;
    text-decoration: none;
}

.sidebar .icon-btn { color: rgba(255,255,255,0.6); }
.sidebar .icon-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text-dark); }
.icon-btn.active { background: var(--blue-light); color: var(--blue); }

/* ===== Email List Pane ===== */
.email-list-pane {
    width: var(--list-w);
    min-width: var(--list-w);
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.list-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-white);
    flex-shrink: 0;
}

.list-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.list-header-left h2 {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge {
    background: var(--red);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    flex-shrink: 0;
}

.list-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: 6px 12px;
    transition: border-color .15s;
}

.search-box:focus-within {
    border-color: var(--accent);
    background: white;
}

.search-box svg { color: var(--text-light); flex-shrink: 0; }

.search-box input {
    border: none;
    outline: none;
    background: none;
    font-size: 13px;
    width: 130px;
    color: var(--text-dark);
}

.clear-search {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 18px;
    line-height: 1;
    padding: 0;
    width: 18px;
    text-align: center;
}

.email-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-mid) transparent;
}

.email-list::-webkit-scrollbar { width: 4px; }
.email-list::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 4px; }

.list-loading, .list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 200px;
    color: var(--text-light);
    font-size: 13px;
}

/* ===== Email List Items ===== */
.email-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    padding: 10px 14px 10px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background .12s;
    position: relative;
    gap: 10px;
}

.email-item:hover { background: var(--bg-hover); }
.email-item.active { background: var(--blue-light); border-left: 3px solid var(--accent); padding-left: 9px; }
.email-item.unread .email-from { font-weight: 700; color: var(--text-dark); }
.email-item.unread .email-subject { font-weight: 600; color: var(--text-dark); }

.email-list-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    margin-top: 2px;
    text-transform: uppercase;
    user-select: none;
}

.email-item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.email-item-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.email-from {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.email-date {
    font-size: 12px;
    color: var(--text-light);
    flex-shrink: 0;
    white-space: nowrap;
}

.email-subject {
    font-size: 13px;
    color: var(--text-mid);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 400;
}

/* Konu + önizleme sarmalayıcı */
.email-subject-row {
    overflow: hidden;
    display: flex;
    align-items: baseline;
    gap: 0;
}

/* Snippet: normal modda gizli */
.email-snippet {
    display: none;
}

.email-preview {
    font-size: 12px;
    color: var(--text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: none;
}

.email-item-footer {
    display: flex;
    align-items: center;
    gap: 6px;
}

.unread-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.flag-star {
    position: absolute;
    right: 14px;
    top: 12px;
    color: var(--border-mid);
    font-size: 14px;
}

.flag-star.flagged { color: var(--yellow); }

/* ===== Pagination ===== */
.list-pagination {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-white);
    flex-shrink: 0;
}

.btn-page {
    background: none;
    border: 1.5px solid var(--border-mid);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-mid);
    transition: all .15s;
}

.btn-page:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-page:disabled { opacity: 0.4; cursor: not-allowed; }

#page-info { font-size: 13px; color: var(--text-light); }

/* ===== Email Content Pane ===== */
.email-content-pane {
    flex: 1;
    background: var(--bg-white);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.content-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--text-light);
    font-size: 14px;
}

.email-content-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-header {
    padding: 20px 32px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-white);
    flex-shrink: 0;
}

.content-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.content-subject {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.3;
    flex: 1;
    word-break: break-word;
}

.content-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    padding-top: 4px;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1.5px solid var(--border-mid);
    border-radius: 6px;
    background: white;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-mid);
    transition: all .15s;
}

.btn-action:hover { border-color: var(--accent); color: var(--accent); background: var(--blue-light); }
.btn-action.btn-danger:hover { border-color: var(--red); color: var(--red); background: #fff5f5; }

.content-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    color: var(--text-mid);
}

.meta-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.meta-info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.meta-from { font-weight: 600; color: var(--text-dark); font-size: 14px; }
.meta-from-email {
    color: var(--text-light);
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.meta-from-email:hover { color: var(--accent); }
.meta-date { font-size: 12.5px; color: var(--text-light); white-space: nowrap; flex-shrink: 0; }

.meta-addresses {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--text-mid);
    padding-top: 8px;
    border-top: 1px solid var(--border);
    line-height: 1.7;
}

.meta-toggle-detail {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background .12s;
}
.meta-toggle-detail:hover { background: var(--bg); color: var(--text-mid); }

.content-body {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    background: var(--bg-white);
}

.content-body iframe {
    width: 100%;
    border: none;
    min-height: 300px;
}

.content-body .text-content {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-dark);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.attachments-bar {
    padding: 12px 32px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--border-mid);
    border-radius: 6px;
    font-size: 12.5px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-mid);
    transition: all .15s;
}

.attachment-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--blue-light); }

/* ===== Compose Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0;
    pointer-events: none;
}

#compose-modal { pointer-events: none; }
#compose-modal .compose-window { pointer-events: auto; }

/* Mini mod — Gmail gibi sağ alt köşe */
.compose-window {
    width: 500px;
    max-width: 100vw;
    background: white;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 8px 40px rgba(0,0,0,.25), 0 2px 8px rgba(0,0,0,.12);
    display: flex;
    flex-direction: column;
    height: 540px;
    max-height: 85vh;
    margin-right: 20px;
}

/* Küçültülmüş mod */
.compose-window[data-minimized="1"] .compose-body,
.compose-window[data-minimized="1"] .compose-footer { display: none !important; }
.compose-window[data-minimized="1"] { height: auto; }

/* Pane modunda (içerik alanında) */
.compose-window.in-pane {
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    max-width: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    position: relative;
}

.compose-window.in-pane .compose-editor {
    max-height: none;
    flex: 1;
    min-height: 0;
}

.compose-window.in-pane .compose-header {
    border-radius: 0 !important;
    background: white !important;
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
}

.compose-window.in-pane .compose-header span {
    color: var(--text-dark) !important;
    font-size: 18px;
    font-weight: 600;
}

.compose-window.in-pane .compose-header .icon-btn {
    color: var(--text-mid) !important;
}

.compose-window.in-pane .compose-header .icon-btn:hover {
    background: var(--bg-hover) !important;
    color: var(--text-dark) !important;
}

.compose-window.in-pane #btn-minimize { display: none; }

/* Gmail-like header (mini mod) */
.compose-header {
    padding: 9px 12px;
    background: #404040;
    color: white;
    border-radius: 10px 10px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    user-select: none;
    cursor: default;
}

.compose-header span { font-weight: 500; font-size: 13px; letter-spacing: 0.1px; }
.compose-header-actions { display: flex; gap: 0px; }
.compose-header .icon-btn { color: rgba(255,255,255,0.8); width: 28px; height: 28px; border-radius: 50%; }
.compose-header .icon-btn:hover { color: white; background: rgba(255,255,255,0.2); }

.compose-body {
    padding: 0;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.compose-field {
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    position: relative;
    min-height: 44px;
}

.compose-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-top: 12px;
    min-width: 44px;
    flex-shrink: 0;
}

.compose-field-row {
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}

.compose-field-subject {
    flex: 1;
    border: none;
    padding: 0;
}

.compose-field-subject input {
    border: none;
    outline: none;
    font-size: 14px;
    width: 100%;
    padding: 12px 0;
    color: var(--text-dark);
    background: none;
    font-weight: 500;
}

.compose-field-subject label {
    padding-top: 12px;
}

.compose-cc-toggle { flex-shrink: 0; }

.recipient-input-wrap {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 6px 0;
    min-height: 44px;
    cursor: text;
}

.chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 10px;
    background: #e8f0fb;
    color: #1a56db;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #c3d9f8;
}

.chip-remove {
    cursor: pointer;
    color: #5a80c0;
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    width: 16px;
    height: 16px;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    transition: background .1s, color .1s;
}

.chip-remove:hover { background: #c3d9f8; color: var(--red); }

.recipient-input-wrap input {
    border: none;
    outline: none;
    font-size: 14px;
    padding: 4px 0;
    min-width: 140px;
    flex: 1;
    background: none;
}

/* ===== Autocomplete (3. ekran görüntüsü gibi) ===== */
.autocomplete-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 500;
    overflow: hidden;
    display: none;
}

.autocomplete-list.open { display: block; }

.autocomplete-item {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background .1s;
}

.autocomplete-item:hover,
.autocomplete-item.focused { background: #f5f7fa; }

.autocomplete-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    text-transform: uppercase;
}

.autocomplete-info { overflow: hidden; flex: 1; }
.autocomplete-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.autocomplete-email {
    font-size: 12.5px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

/* ===== Toolbar ===== */
.compose-editor-toolbar {
    padding: 4px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1px;
    background: #fafbfc;
    flex-shrink: 0;
    flex-wrap: wrap;
    min-height: 40px;
}

.toolbar-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-mid);
    transition: background .12s, color .12s;
    flex-shrink: 0;
}

.toolbar-btn:hover { background: var(--border); color: var(--text-dark); }
.toolbar-btn.active { background: var(--blue-light); color: var(--blue); }
.toolbar-bold { font-weight: 800; font-size: 15px; }
.toolbar-italic { font-style: italic; font-size: 15px; }
.toolbar-underline { text-decoration: underline; font-size: 15px; }
.toolbar-strike { text-decoration: line-through; font-size: 15px; }

.toolbar-sep { width: 1px; height: 20px; background: var(--border-mid); margin: 0 3px; flex-shrink: 0; }

.toolbar-dropdown-wrap { display: flex; align-items: center; }

.toolbar-select {
    height: 28px;
    border: 1px solid var(--border-mid);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-mid);
    background: white;
    padding: 0 4px;
    cursor: pointer;
    outline: none;
    width: 80px;
}

.toolbar-select-sm { width: 46px; }
.toolbar-select:focus { border-color: var(--accent); }

.toolbar-color-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.toolbar-color-wrap input[type="color"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.color-btn {
    position: relative;
    flex-direction: column;
    gap: 1px;
    height: 30px;
    width: 30px;
    cursor: pointer;
}

#color-indicator {
    width: 16px;
    height: 3px;
    border-radius: 2px;
    display: block;
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.compose-body > form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.compose-editor {
    flex: 1;
    padding: 16px 20px;
    outline: none;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-dark);
    overflow-y: auto;
    min-height: 120px;
    font-family: Arial, sans-serif;
}

.compose-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--text-light);
    pointer-events: none;
}

/* Ek dosyalar */
.compose-attach-bar {
    padding: 6px 16px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: #fafbfc;
}

.compose-attach-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 10px 3px 8px;
    font-size: 12px;
    color: var(--text-mid);
    max-width: 220px;
}

.compose-attach-chip svg { flex-shrink: 0; color: var(--primary); }
.compose-attach-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compose-attach-size { color: var(--text-light); }
.compose-attach-chip button {
    background: none; border: none; cursor: pointer;
    color: var(--text-light); font-size: 15px; line-height: 1;
    padding: 0 0 0 2px; flex-shrink: 0;
}
.compose-attach-chip button:hover { color: var(--danger, #e53e3e); }

/* Ek dosya butonu */
.attach-btn {
    cursor: pointer;
    color: var(--text-mid);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 6px;
    transition: background .15s, color .15s;
}
.attach-btn:hover { background: var(--bg-hover); color: var(--primary); }

/* Drag-over vurgusu */
.compose-window.drag-over { outline: 2px dashed var(--primary); outline-offset: -3px; }

.compose-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: white;
}

.compose-footer-right { display: flex; align-items: center; gap: 4px; }

/* ===== Settings Panel ===== */
.settings-panel {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 520px;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    margin: auto;
}

#settings-modal {
    align-items: center;
    justify-content: center;
}

.settings-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-header h3 { font-size: 17px; font-weight: 700; }
.settings-header .icon-btn { font-size: 22px; }

.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.settings-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.tab-btn {
    padding: 8px 16px;
    background: none;
    border: none;
    border-bottom: 2.5px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: -1px;
    transition: color .15s, border-color .15s;
}

.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:hover { color: var(--text-dark); }

.tab-content h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-mid);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 16px 0 12px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-group-sm { min-width: 100px; max-width: 120px; }

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input { width: auto !important; cursor: pointer; }

.settings-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.contacts-search {
    margin-bottom: 12px;
}

.contacts-search input {
    width: 100%;
    padding: 9px 14px;
    border: 1.5px solid var(--border-mid);
    border-radius: var(--radius);
    font-size: 13.5px;
    outline: none;
    transition: border-color .15s;
}

.contacts-search input:focus { border-color: var(--accent); }

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}

.contact-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--blue-light);
    color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.contact-info { overflow: hidden; }
.contact-name { font-size: 13.5px; font-weight: 500; }
.contact-email { font-size: 12px; color: var(--text-light); }

/* ===== Spinners ===== */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255,255,255,0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.email-list-pane .spinner-sm,
.settings-body .spinner-sm {
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: toastIn .2s ease;
    pointer-events: auto;
    white-space: nowrap;
    color: white;
}

.toast-success { background: var(--green); }
.toast-error   { background: var(--red); }
.toast-info    { background: var(--navy); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== Sidebar Toggle ===== */
.sidebar-toggle { display: flex; }

/* ===== Reply Quote ===== */
.reply-quote {
    margin-top: 20px;
    padding: 12px 16px;
    border-left: 3px solid var(--border-mid);
    color: var(--text-mid);
    font-size: 13px;
    background: var(--bg);
    border-radius: 0 4px 4px 0;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .email-content-pane { display: none; }
    .email-content-pane.mobile-active { display: flex; position: fixed; inset: 0; z-index: 50; }
    .email-list-pane { min-width: 0; width: 100%; }
    :root { --list-w: 100%; }
}

@media (max-width: 640px) {
    .sidebar { position: fixed; inset: 0; width: var(--sidebar-w) !important; min-width: var(--sidebar-w) !important; transform: translateX(-100%); transition: transform .25s; }
    .sidebar.mobile-open { transform: translateX(0); }
    .compose-window { margin-right: 0; width: 100%; border-radius: 12px 12px 0 0; }
}

/* ===== Content body styles ===== */
.content-body img { max-width: 100%; height: auto; }
.content-body blockquote {
    margin: 12px 0;
    padding: 8px 16px;
    border-left: 3px solid var(--border-mid);
    color: var(--text-mid);
    background: var(--bg);
}

/* Folder icons color */
.folder-inbox    { color: #3b82f6; }
.folder-sent     { color: #10b981; }
.folder-drafts   { color: #f59e0b; }
.folder-spam     { color: #ef4444; }
.folder-trash    { color: #6b7280; }
.folder-default  { color: rgba(255,255,255,0.6); }


/* ===== Pane Back Button (list-focus mode) ===== */
.pane-back-btn {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--bg-white);
    border: none;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-mid);
    font-size: 13px;
    width: 100%;
    flex-shrink: 0;
    text-align: left;
}
.pane-back-btn:hover { color: var(--text-dark); background: var(--bg); }
.mail-page.list-focus.detail-open .pane-back-btn { display: flex; }

/* ===== List-focus: sadece okuma paneli gizlenir, sidebar açık kalır ===== */
.mail-page.list-focus .email-content-pane { display: none !important; }
.mail-page.list-focus .email-list-pane { flex: 1 !important; width: auto !important; min-width: 0 !important; }

/* List-focus + detay açık: sadece okuma paneli görünür */
.mail-page.list-focus.detail-open .email-list-pane { display: none !important; }
.mail-page.list-focus.detail-open .email-content-pane { display: flex !important; flex: 1 !important; }

/* ===== List-focus: Kurumsal Yatay Düzen ===== */
.email-check-wrap {
    display: none;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 2px;
}
.email-checkbox { cursor: pointer; width: 15px; height: 15px; accent-color: var(--accent); }

/* Header güçlendir */
.mail-page.list-focus .list-header {
    padding: 0 20px;
    height: 54px;
    border-bottom: 2px solid var(--border);
    background: #fff;
}
.mail-page.list-focus .list-header-left h2 {
    font-size: 17px;
    font-weight: 800;
    color: var(--navy);
    letter-spacing: -0.4px;
}
.mail-page.list-focus .badge {
    font-size: 11.5px;
    padding: 3px 8px;
    background: var(--accent);
}

/* Sütun başlık çizgisi */
.mail-page.list-focus .email-list {
    border-top: none;
}
.mail-page.list-focus .email-list::before {
    content: '';
    display: block;
    height: 1px;
    background: var(--border);
}

/* Satır */
.mail-page.list-focus .email-check-wrap { display: flex; }

.mail-page.list-focus .email-item {
    height: 52px;
    padding: 0 20px 0 0;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #eef0f4;
    border-left: 3px solid transparent;
    transition: background .1s, border-left-color .1s;
}

/* Okunmamış: sol mavi şerit */
.mail-page.list-focus .email-item.unread {
    border-left-color: var(--accent);
    background: #fafcff;
}

.mail-page.list-focus .email-item:hover {
    background: #f4f7fd;
}
.mail-page.list-focus .email-item.active {
    background: var(--blue-light);
    border-left-color: var(--blue);
}

/* Avatar */
.mail-page.list-focus .email-list-avatar {
    width: 34px;
    height: 34px;
    font-size: 12px;
    margin-top: 0;
    flex-shrink: 0;
    margin-left: 14px;
}

/* email-item-main tek satır yatay */
.mail-page.list-focus .email-item-main {
    flex-direction: row;
    align-items: center;
    gap: 0;
    overflow: hidden;
}

/* email-item-header'ı erit */
.mail-page.list-focus .email-item-header { display: contents; }

/* Gönderen */
.mail-page.list-focus .email-from {
    width: 190px;
    min-width: 190px;
    flex: none;
    order: 1;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-mid);
    padding-right: 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mail-page.list-focus .email-item.unread .email-from {
    font-weight: 700;
    color: var(--navy);
}

/* Konu + snippet: ortada */
.mail-page.list-focus .email-subject-row {
    flex: 1;
    order: 2;
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

/* Konu */
.mail-page.list-focus .email-subject {
    flex-shrink: 0;
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13.5px;
    font-weight: 400;
    color: var(--text-mid);
}
.mail-page.list-focus .email-item.unread .email-subject {
    font-weight: 700;
    color: var(--navy);
}

/* Ayırıcı */
.mail-page.list-focus .email-subject::after {
    content: ' —';
    color: #c8d0da;
    font-weight: 400;
}

/* Snippet */
.mail-page.list-focus .email-snippet {
    display: block;
    color: var(--text-light);
    font-size: 13px;
    font-weight: 400 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

/* Tarih */
.mail-page.list-focus .email-date {
    order: 3;
    width: 60px;
    text-align: right;
    flex-shrink: 0;
    padding-left: 8px;
    font-size: 12.5px;
    color: var(--text-light);
    font-weight: 400;
}
.mail-page.list-focus .email-item.unread .email-date {
    color: var(--text-mid);
    font-weight: 600;
}
