* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f4f6f8;
    color: #222;
    line-height: 1.5;
}

a { color: #2962ff; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: #fff;
    border-bottom: 1px solid #e3e6ea;
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar .brand {
    font-weight: 700;
    font-size: 18px;
    color: #1a237e;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar .hello {
    color: #555;
    font-size: 14px;
    margin-right: 8px;
}

.container {
    max-width: 960px;
    margin: 24px auto;
    padding: 0 16px;
}

h1 {
    margin-top: 0;
    font-size: 22px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.page-head h1 { margin: 0; }
.inline-form { display: inline; margin: 0; }

.search-form {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    max-width: 420px;
    margin: 0;
}
.search-form input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #c7ccd1;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}
.search-form input[type="text"]:focus {
    outline: none;
    border-color: #2962ff;
    box-shadow: 0 0 0 3px rgba(41, 98, 255, 0.15);
}

.muted { color: #888; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: #eef1f5;
    color: #222;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: #e1e6ec; text-decoration: none; }

.btn-primary {
    background: #2962ff;
    color: #fff;
}
.btn-primary:hover { background: #1e4dd0; }

.btn-ghost {
    background: transparent;
    border-color: #c7ccd1;
}
.btn-ghost:hover { background: #f0f2f5; }

/* Alerts */
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    font-size: 14px;
}
.alert-error   { background: #fdecea; color: #b00020; border-color: #f5c2c0; }
.alert-success { background: #e7f4ea; color: #1b5e20; border-color: #b9deba; }

/* Auth (login) */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    padding: 28px;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.auth-card h1 { text-align: center; margin-bottom: 20px; }

/* Forms */
form label {
    display: block;
    font-size: 13px;
    color: #444;
    margin-bottom: 14px;
}
form input[type="text"],
form input[type="email"],
form input[type="password"],
form textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 10px 12px;
    border: 1px solid #c7ccd1;
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
}
form input:focus,
form textarea:focus {
    outline: none;
    border-color: #2962ff;
    box-shadow: 0 0 0 3px rgba(41, 98, 255, 0.15);
}
form input[disabled] { background: #f5f5f5; color: #777; }

.compose-form .actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

/* Mail list */
.mail-list {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.mail-list th,
.mail-list td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #eef0f3;
    font-size: 14px;
    vertical-align: top;
}
.mail-list th {
    background: #f8fafc;
    color: #555;
    font-weight: 600;
}
.mail-list tbody tr:hover { background: #f6f9fd; }
.mail-list tbody tr:last-child td { border-bottom: none; }

.mail-list tbody tr.is-unread td { font-weight: 600; background: #fbfdff; }
.mail-list tbody tr.is-read td   { color: #555; }

.dot-unread {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: #2962ff;
    vertical-align: middle;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 16px;
}
.page-link {
    padding: 6px 11px;
    border: 1px solid #c7ccd1;
    border-radius: 4px;
    background: #fff;
    color: #2962ff;
    font-size: 14px;
    text-decoration: none;
    user-select: none;
}
.page-link:hover { background: #f0f4fa; text-decoration: none; }
.page-link.current {
    background: #2962ff;
    color: #fff;
    border-color: #2962ff;
    cursor: default;
}
.page-link.disabled {
    color: #aaa;
    background: #f5f5f5;
    cursor: not-allowed;
}
.page-info {
    margin-left: auto;
    color: #777;
    font-size: 13px;
}

/* Mail view */
.mail-view {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.mail-meta {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 4px 12px;
    margin: 0 0 20px;
    color: #555;
    font-size: 14px;
}
.mail-meta dt { font-weight: 600; }
.mail-meta dd { margin: 0; }
.mail-body {
    border-top: 1px solid #eef0f3;
    padding-top: 16px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.mail-iframe {
    width: 100%;
    min-height: 480px;
    border: 1px solid #e3e6ea;
    border-radius: 6px;
    background: #fff;
    margin-top: 8px;
}
