:root {
    font-family: Arial, Helvetica, sans-serif;
    color: #202124;
    background: #f6f8fc;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-size: 14px;
}

.topbar {
    height: 72px;
    background: #f6f8fc;
    display: flex;
    align-items: center;
    gap: 34px;
    padding: 0 22px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 270px;
    color: #202124;
    text-decoration: none;
}

.brand-name {
    font-size: 22px;
    font-weight: 500;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: #4285f4;
    color: white;
    font-size: 22px;
    font-weight: bold;
}

.search {
    height: 48px;
    max-width: 720px;
    flex: 1;
    display: flex;
    align-items: center;
    background: #e9eef6;
    border-radius: 24px;
}

.search-icon {
    padding-left: 20px;
    font-size: 27px;
    color: #4b5563;
}

.search input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    padding: 0 15px;
    font-size: 16px;
}

.search button {
    border: 0;
    background: transparent;
    font-size: 22px;
    margin-right: 15px;
}

.top-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 25px;
    color: #4b5563;
    font-size: 22px;
}

.avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #38761d;
    color: white;
    font-size: 16px;
}

.app-layout {
    display: flex;
    min-height: calc(100vh - 72px);
}

.sidebar {
    width: 300px;
    padding: 18px 18px;
    flex-shrink: 0;
}

.compose {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 190px;
    padding: 17px 25px;
    margin-bottom: 22px;
    border-radius: 17px;
    background: #c2e7ff;
    color: #202124;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 1px 3px #00000015;
}

.compose span {
    font-size: 23px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 17px;
    height: 42px;
    padding: 0 18px;
    border-radius: 0 22px 22px 0;
    color: #30343b;
    text-decoration: none;
}

.nav-item:hover {
    background: #e8eef7;
}

.nav-item.active {
    background: #d3e3fd;
    color: #174ea6;
    font-weight: bold;
}

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 18px;
}

.count {
    margin-left: auto;
    font-size: 12px;
}

.sidebar-section {
    margin: 28px 20px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    color: #444746;
    font-weight: 600;
}

.main-content {
    flex: 1;
    min-width: 0;
    margin-right: 18px;
    background: white;
    border-radius: 18px 18px 0 0;
    overflow: hidden;
}

.mail-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 58px;
    padding: 0 22px;
    border-bottom: 1px solid #e5e7eb;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
    color: #555;
}

.mail-toolbar button {
    border: 0;
    background: transparent;
    color: #555;
    font-size: 20px;
}

.toolbar-right span {
    font-size: 12px;
}

.mail-tabs {
    display: flex;
    height: 58px;
    border-bottom: 1px solid #e5e7eb;
}

.tab {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 220px;
    padding: 0 25px;
    color: #5f6368;
    font-weight: 600;
}

.tab.active {
    color: #1a73e8;
    border-bottom: 3px solid #1a73e8;
}

.message-row {
    display: grid;
    grid-template-columns: 35px 35px 260px minmax(200px, 1fr) 160px;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 22px;
    border-bottom: 1px solid #edf0f4;
    color: #303134;
    text-decoration: none;
    white-space: nowrap;
}

.message-row:hover {
    box-shadow: 0 1px 4px #0002;
    position: relative;
    z-index: 1;
}

.mail-check input,
.toolbar-left input {
    width: 17px;
    height: 17px;
}

.star {
    color: #9aa0a6;
    font-size: 23px;
}

.sender {
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.subject {
    overflow: hidden;
    text-overflow: ellipsis;
}

.subject strong {
    font-weight: 600;
}

.date {
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
    color: #5f6368;
    font-size: 12px;
}

.empty {
    padding: 100px;
    text-align: center;
    color: #777;
}

.alert {
    margin: 15px;
    padding: 12px;
    border-radius: 7px;
}

.alert.error {
    color: #991b1b;
    background: #fee2e2;
}

.alert.success {
    color: #166534;
    background: #dcfce7;
}

@media (max-width: 900px) {
    .brand { width: auto; }
    .brand-name { display: none; }
    .sidebar { width: 210px; }
    .message-row {
        grid-template-columns: 30px 30px 1fr 1fr;
    }
    .date { display: none; }
    .tab { width: 33%; }
}

@media (max-width: 650px) {
    .topbar { gap: 12px; padding: 0 10px; }
    .top-actions { gap: 10px; }
    .sidebar { width: 70px; padding: 12px 4px; }
    .compose { width: 58px; padding: 16px; }
    .compose { font-size: 0; }
    .nav-item { justify-content: center; padding: 0; }
    .nav-item span:not(.nav-icon),
    .section-title { display: none; }
    .main-content { margin-right: 0; border-radius: 0; }
    .message-row {
        grid-template-columns: 28px 28px 1fr;
        padding: 0 10px;
    }
    .subject { display: none; }
}

.message-toolbar {
    height: 58px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 22px;
    border-bottom: 1px solid #e5e7eb;
}

.message-toolbar form {
    margin: 0;
}

.icon-button {
    display: grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #5f6368;
    font-size: 19px;
    text-decoration: none;
    cursor: pointer;
}

.icon-button:hover {
    background: #e8eaed;
}

.toolbar-separator {
    flex: 1;
}

.message-card {
    background: white;
    padding: 28px 42px 60px;
    min-height: 700px;
}

.message-heading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.message-heading h1 {
    margin: 0;
    color: #202124;
    font-size: 24px;
    font-weight: 400;
}

.star-large {
    border: 0;
    background: transparent;
    color: #9aa0a6;
    font-size: 27px;
    cursor: pointer;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 28px;
    padding-bottom: 22px;
    border-bottom: 1px solid #edf0f4;
}

.sender-avatar {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #5b8def;
    color: white;
    font-size: 18px;
    font-weight: bold;
}

.sender-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #202124;
}

.sender-info span {
    color: #5f6368;
    font-size: 12px;
}

.message-date {
    margin-left: auto;
    color: #5f6368;
    font-size: 12px;
}

.message-body {
    max-width: 900px;
    padding: 30px 5px;
    color: #202124;
    font-size: 15px;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.message-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

.message-actions button {
    padding: 9px 18px;
    border: 1px solid #dadce0;
    border-radius: 18px;
    background: white;
    color: #3c4043;
    cursor: pointer;
}

.message-actions button:hover {
    background: #f1f3f4;
}

@media (max-width: 700px) {
    .message-card {
        padding: 22px 16px 45px;
    }

    .message-date {
        display: none;
    }
}

.compose-page {
    min-height: calc(100vh - 72px);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0 28px 0 0;
}

.compose-window {
    width: 650px;
    height: 570px;
    background: white;
    border-radius: 9px 9px 0 0;
    box-shadow: 0 5px 25px #0003;
    overflow: hidden;
}

.compose-titlebar {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    background: #404040;
    color: white;
    font-size: 14px;
}

.compose-window-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.compose-window-buttons button,
.compose-window-buttons a {
    border: 0;
    background: transparent;
    color: white;
    font-size: 18px;
    text-decoration: none;
    cursor: pointer;
}

.gmail-compose-form {
    height: calc(100% - 44px);
    display: flex;
    flex-direction: column;
    padding: 0 18px 16px;
}

.gmail-compose-form input {
    height: 45px;
    border: 0;
    border-bottom: 1px solid #e5e7eb;
    outline: 0;
    font-size: 14px;
}

.gmail-compose-form textarea {
    flex: 1;
    width: 100%;
    padding: 18px 0;
    border: 0;
    outline: 0;
    resize: none;
    font: 14px/1.6 Arial, sans-serif;
}

.compose-bottom {
    display: flex;
    align-items: center;
    gap: 18px;
}

.send-button {
    padding: 10px 23px;
    border: 0;
    border-radius: 18px;
    background: #0b57d0;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.attachment-button,
.format-button {
    border: 0;
    background: transparent;
    color: #5f6368;
    font-size: 18px;
    cursor: pointer;
}

.attachment-button input {
    display: none;
}

.reply-button {
    display: inline-block;
    padding: 10px 22px;
    border: 1px solid #dadce0;
    border-radius: 18px;
    color: #3c4043;
    text-decoration: none;
    font-size: 14px;
}

.reply-button:hover {
    background: #f1f3f4;
}

@media (max-width: 700px) {
    .compose-page {
        padding: 0;
    }

    .compose-window {
        width: 100%;
        height: calc(100vh - 72px);
        border-radius: 0;
    }
}

.compose-page {
    min-height: calc(100vh - 72px);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0 28px 0 0;
}

.compose-window {
    width: 650px;
    height: 570px;
    background: white;
    border-radius: 9px 9px 0 0;
    box-shadow: 0 5px 25px #0003;
    overflow: hidden;
}

.compose-titlebar {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    background: #404040;
    color: white;
    font-size: 14px;
}

.compose-window-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.compose-window-buttons button,
.compose-window-buttons a {
    border: 0;
    background: transparent;
    color: white;
    font-size: 18px;
    text-decoration: none;
    cursor: pointer;
}

.gmail-compose-form {
    height: calc(100% - 44px);
    display: flex;
    flex-direction: column;
    padding: 0 18px 16px;
}

.gmail-compose-form input {
    height: 45px;
    border: 0;
    border-bottom: 1px solid #e5e7eb;
    outline: 0;
    font-size: 14px;
}

.gmail-compose-form textarea {
    flex: 1;
    width: 100%;
    padding: 18px 0;
    border: 0;
    outline: 0;
    resize: none;
    font: 14px/1.6 Arial, sans-serif;
}

.compose-bottom {
    display: flex;
    align-items: center;
    gap: 18px;
}

.send-button {
    padding: 10px 23px;
    border: 0;
    border-radius: 18px;
    background: #0b57d0;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.attachment-button,
.format-button {
    border: 0;
    background: transparent;
    color: #5f6368;
    font-size: 18px;
    cursor: pointer;
}

.attachment-button input {
    display: none;
}

.reply-button {
    display: inline-block;
    padding: 10px 22px;
    border: 1px solid #dadce0;
    border-radius: 18px;
    color: #3c4043;
    text-decoration: none;
    font-size: 14px;
}

.reply-button:hover {
    background: #f1f3f4;
}

@media (max-width: 700px) {
    .compose-page {
        padding: 0;
    }

    .compose-window {
        width: 100%;
        height: calc(100vh - 72px);
        border-radius: 0;
    }
}
