* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f6f8;
    color: #1a1a1a;
}
.hidden { display: none !important; }

/* Login */
.login-screen {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    width: 300px;
    text-align: center;
}
.login-box h1 { margin-top: 0; font-size: 22px; }
.login-box input {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
.login-box button {
    width: 100%;
    padding: 10px;
    background: #3462eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}
.error-text { color: #d33; font-size: 13px; min-height: 18px; }
.status-text { font-size: 13px; min-height: 18px; }

/* App layout */
.app {
    display: grid;
    grid-template-columns: 220px 320px 1fr;
    height: 100vh;
}
.sidebar {
    background: #fff;
    border-right: 1px solid #e5e5e5;
    padding: 16px;
}
.compose-btn {
    width: 100%;
    padding: 10px;
    background: #3462eb;
    color: #fff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 16px;
}
.folder-list { list-style: none; padding: 0; margin: 0; }
.folder-list li {
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}
.folder-list li:hover, .folder-list li.active {
    background: #eef1fd;
    color: #3462eb;
}

.sidebar-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
#current-user {
    font-size: 12px;
    color: #888;
    word-break: break-all;
}
#logout-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    align-self: flex-start;
}
#logout-btn:hover { background: #f5f5f5; }

.message-list-pane {
    border-right: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    background: #fff;
}
.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #e5e5e5;
}
.pane-header h2 { font-size: 16px; margin: 0; }
.pane-header button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
}
.message-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.message-list li {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}
.message-list li:hover { background: #f8f9fb; }
.message-list li.unread { font-weight: 600; }
.message-list li.selected { background: #eef1fd; }
.msg-from { font-size: 13px; color: #333; }
.msg-subject { font-size: 13px; color: #555; margin-top: 2px; }
.msg-date { font-size: 11px; color: #999; margin-top: 4px; }

.pagination {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid #e5e5e5;
}
.pagination button {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
}

.message-view-pane { background: #fff; overflow-y: auto; }
.message-view { padding: 24px; }
.message-view .placeholder { color: #999; }
.msg-header { border-bottom: 1px solid #eee; padding-bottom: 16px; margin-bottom: 16px; }
.msg-header h3 { margin: 0 0 8px 0; }
.msg-meta { font-size: 13px; color: #666; margin: 2px 0; }
.msg-body { font-size: 14px; line-height: 1.6; }
.msg-actions { margin-top: 20px; display: flex; gap: 10px; }
.msg-actions button {
    padding: 8px 14px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}
.msg-actions button:hover { background: #f5f5f5; }

/* Compose modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-box {
    background: #fff;
    padding: 24px;
    border-radius: 10px;
    width: 480px;
    max-width: 90vw;
}
.modal-box h3 { margin-top: 0; }
.modal-box input, .modal-box textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal-actions button {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
}
#compose-cancel { background: #eee; }
.modal-actions button[type="submit"] { background: #3462eb; color: #fff; }
