* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0f0f13;
    color: #e1e1e6;
    min-height: 100vh;
}

.container { max-width: 780px; margin: 0 auto; padding: 40px 20px; }

header { text-align: center; margin-bottom: 40px; }
header h1 { font-size: 2.2rem; color: #fff; }
.subtitle { color: #888; margin-top: 6px; font-size: 1rem; }

.card {
    background: #1a1a23;
    border: 1px solid #2a2a3a;
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 12px;
}

.card h2 { font-size: 1.1rem; margin-bottom: 16px; color: #ccc; }

.input-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.input-group input[type="text"],
.input-group input[type="email"] {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    background: #12121a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus { border-color: #6c5ce7; }

.domain-suffix {
    color: #888;
    font-size: 0.95rem;
    white-space: nowrap;
    padding: 0 4px;
}

.input-group button, .btn-secondary, .btn-danger {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.input-group button {
    background: #6c5ce7;
    color: #fff;
}
.input-group button:hover { background: #5a4bd1; }
.input-group button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    background: #2a2a3a;
    color: #ccc;
}
.btn-secondary:hover { background: #3a3a4a; }

.btn-danger {
    background: #e74c3c;
    color: #fff;
}
.btn-danger:hover { background: #c0392b; }

.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
    color: #555;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #2a2a3a;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    background: #6c5ce7;
    color: #fff;
    margin-right: 6px;
}
.badge-secondary { background: #2a2a3a; color: #999; }

#inbox-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}
#inbox-header h2 { font-size: 1.1rem; margin-bottom: 6px; word-break: break-all; }
.inbox-actions { display: flex; gap: 6px; flex-wrap: wrap; }

#inbox-messages { min-height: 200px; }

.message-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #2a2a3a;
    cursor: pointer;
    transition: background 0.15s;
    align-items: center;
}
.message-item:last-child { border-bottom: none; }
.message-item:hover { background: #22222e; }
.message-item.unread { background: #1e1e2e; border-left: 3px solid #6c5ce7; }

.msg-from { flex: 0 0 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #aaa; font-size: 0.9rem; }
.msg-subject { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #ddd; }
.msg-time { flex: 0 0 150px; text-align: right; color: #666; font-size: 0.8rem; }

.unread .msg-from, .unread .msg-subject { color: #fff; font-weight: 600; }

.loading, .empty-state, .error-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}
.empty-state { font-size: 1.1rem; color: #555; }
.error-state { color: #e74c3c; }

.message-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}
.message-toolbar button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    background: #2a2a3a;
    color: #ccc;
    transition: all 0.2s;
}
.message-toolbar button:hover { background: #3a3a4a; }

.message-header {
    margin-bottom: 16px;
}
.msg-field {
    padding: 6px 0;
    font-size: 0.9rem;
    color: #aaa;
    word-break: break-word;
}
.msg-field strong { color: #ddd; }

.message-body {
    padding: 8px 0;
}
.text-body {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #bbb;
    line-height: 1.5;
}
.html-body {
    max-width: 100%;
    overflow-x: auto;
}
.html-body img { max-width: 100%; height: auto; }

.attachments {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #2a2a3a;
}
.attachments h4 { margin-bottom: 10px; color: #aaa; }
.attachment-item { padding: 8px 0; color: #888; font-size: 0.9rem; }

hr { border: none; border-top: 1px solid #2a2a3a; margin: 16px 0; }

@media (max-width: 600px) {
    .container { padding: 20px 12px; }
    .message-item { flex-wrap: wrap; gap: 4px; }
    .msg-from { flex-basis: 100%; }
    .msg-time { flex-basis: 100%; text-align: left; }
    .input-group input { min-width: 140px; }
    #inbox-header { flex-direction: column; }
}
