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

body {
    min-height: 100vh;
    overflow: hidden;
    background: #f6f8fc;
    color: #202124;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
}

.app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
}

.topbar {
    display: grid;
    grid-template-columns: 240px minmax(280px, 720px) 1fr;
    align-items: center;
    gap: 24px;
    height: 64px;
    padding: 8px 18px;
    background: #f6f8fc;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.menu-icon,
.menu-icon::before,
.menu-icon::after {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 10px;
    background: #5f6368;
}

.menu-icon {
    position: relative;
}

.menu-icon::before,
.menu-icon::after {
    content: "";
    position: absolute;
    left: 0;
}

.menu-icon::before {
    top: -6px;
}

.menu-icon::after {
    top: 6px;
}

.gmail-mark {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.brand-name {
    color: #5f6368;
    font-size: 21px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 48px;
    padding: 0 18px;
    border-radius: 24px;
    background: #eef3fb;
    color: #5f6368;
}

.search-icon {
    position: relative;
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    border: 2px solid #5f6368;
    border-radius: 50%;
}

.search-icon::after {
    content: "";
    position: absolute;
    right: -5px;
    bottom: -4px;
    width: 7px;
    height: 2px;
    border-radius: 4px;
    background: #5f6368;
    transform: rotate(45deg);
}

.search-box input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: #202124;
    font-size: 14px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    color: #5f6368;
    font-size: 13px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1e8e3e;
}

.icon-button,
.avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
}

.avatar {
    background: #1a73e8;
    color: #fff;
    font-weight: 700;
}

.mail-shell {
    display: grid;
    grid-template-columns: 248px minmax(420px, 1fr) minmax(340px, 42vw);
    gap: 12px;
    height: calc(100vh - 64px);
    padding: 0 16px 16px 0;
}

.sidebar {
    height: 100%;
    padding: 8px 12px 16px;
    overflow-y: auto;
    background: #f6f8fc;
}

.compose-button {
    width: 136px;
    height: 56px;
    margin: 0 0 16px 8px;
    border: 0;
    border-radius: 16px;
    background: #c2e7ff;
    color: #001d35;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3);
    cursor: default;
    font-size: 14px;
    font-weight: 600;
}

.mail-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mail-nav a {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 32px;
    padding: 0 12px 0 18px;
    border-radius: 0 18px 18px 0;
    color: #3c4043;
    text-decoration: none;
}

.mail-nav a.active {
    background: #d3e3fd;
    color: #001d35;
    font-weight: 700;
}

.mail-nav strong {
    margin-left: auto;
    font-size: 12px;
}

.nav-icon {
    width: 16px;
    height: 16px;
    border: 2px solid #5f6368;
}

.inbox-icon {
    border-radius: 3px;
    border-top-width: 5px;
}

.star-icon {
    clip-path: polygon(50% 0, 62% 34%, 98% 34%, 68% 55%, 80% 92%, 50% 70%, 20% 92%, 32% 55%, 2% 34%, 38% 34%);
    border: 0;
    background: #5f6368;
}

.clock-icon {
    border-radius: 50%;
}

.sent-icon {
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-right: 0;
    border-bottom: 8px solid transparent;
    border-left: 16px solid #5f6368;
}

.draft-icon {
    border-radius: 2px;
}

.labels {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 30px 0 0 18px;
    color: #5f6368;
    font-size: 13px;
}

.labels-heading {
    color: #202124;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.labels span {
    display: flex;
    align-items: center;
    gap: 10px;
}

.labels i {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.label-blue {
    background: #1a73e8;
}

.label-green {
    background: #34a853;
}

.label-yellow {
    background: #fbbc04;
}

.main-content,
.email-detail {
    min-height: 0;
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
}

.main-content {
    display: flex;
    flex-direction: column;
}

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 12px;
}

.main-header h1 {
    font-size: 22px;
    font-weight: 500;
}

.main-header p,
.mail-count {
    color: #5f6368;
    font-size: 12px;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 44px;
    padding: 0 18px;
    border-bottom: 1px solid #e8eaed;
    color: #5f6368;
}

.toolbar-square {
    width: 16px;
    height: 16px;
    border: 2px solid #9aa0a6;
    border-radius: 3px;
}

.refresh-icon {
    width: 16px;
    height: 16px;
    border: 2px solid #9aa0a6;
    border-right-color: transparent;
    border-radius: 50%;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: #e8eaed;
}

.toolbar-text {
    color: #d93025;
    font-weight: 700;
}

.email-list {
    flex: 1;
    overflow-y: auto;
}

.email-item {
    display: grid;
    grid-template-columns: 28px minmax(120px, 210px) minmax(180px, 1fr) 72px;
    align-items: center;
    min-height: 42px;
    padding: 0 14px;
    border-bottom: 1px solid #edf0f2;
    background: #fff;
    box-shadow: inset 0 -1px 0 rgba(100, 121, 143, 0.12);
    cursor: pointer;
    outline: none;
}

.email-item:hover,
.email-item:focus,
.email-item.selected {
    position: relative;
    z-index: 1;
    background: #f2f6fc;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.2);
}

.star {
    width: 16px;
    height: 16px;
    clip-path: polygon(50% 0, 62% 34%, 98% 34%, 68% 55%, 80% 92%, 50% 70%, 20% 92%, 32% 55%, 2% 34%, 38% 34%);
    background: #c4c7c5;
}

.sender {
    overflow: hidden;
    color: #202124;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-line {
    display: flex;
    min-width: 0;
    gap: 6px;
    overflow: hidden;
    color: #5f6368;
    white-space: nowrap;
}

.message-line strong {
    flex: 0 1 auto;
    overflow: hidden;
    color: #202124;
    font-size: 13px;
    text-overflow: ellipsis;
}

.message-line span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-item time {
    color: #5f6368;
    font-size: 12px;
    font-weight: 700;
    text-align: right;
}

.email-detail {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-left: 1px solid #e8eaed;
}

.empty-state {
    display: grid;
    place-items: center;
    gap: 14px;
    height: 100%;
    color: #5f6368;
    text-align: center;
}

.empty-icon {
    width: 58px;
    height: 42px;
    border: 3px solid #d3e3fd;
    border-radius: 8px;
    background: linear-gradient(135deg, transparent 46%, #d3e3fd 47% 53%, transparent 54%);
}

.detail-header {
    padding: 28px 32px 18px;
    border-bottom: 1px solid #e8eaed;
}

.detail-header h2 {
    margin-bottom: 22px;
    color: #202124;
    font-size: 22px;
    font-weight: 400;
    line-height: 1.3;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #5f6368;
    font-size: 13px;
}

.detail-meta div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.detail-meta strong {
    color: #202124;
}

.detail-avatar {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #d3e3fd;
    color: #174ea6;
    font-weight: 700;
}

.message-body {
    padding: 24px 32px 40px;
    color: #202124;
    font-size: 14px;
    line-height: 1.55;
}

.message-body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 16px 0;
    border-radius: 8px;
}

@media (max-width: 1100px) {
    .topbar {
        grid-template-columns: 200px 1fr auto;
    }

    .mail-shell {
        grid-template-columns: 200px minmax(360px, 1fr);
    }

    .email-detail {
        display: none;
    }

    .email-detail.is-open {
        display: flex;
        position: fixed;
        inset: 76px 16px 16px 216px;
        z-index: 5;
        box-shadow: 0 8px 24px rgba(60, 64, 67, 0.3);
    }
}

@media (max-width: 760px) {
    body {
        overflow: auto;
    }

    .app-container {
        height: auto;
        min-height: 100vh;
    }

    .topbar {
        grid-template-columns: 1fr;
        height: auto;
        gap: 12px;
    }

    .topbar-actions {
        display: none;
    }

    .mail-shell {
        display: block;
        height: auto;
        padding: 0 10px 12px;
    }

    .sidebar {
        display: none;
    }

    .main-content {
        min-height: 72vh;
    }

    .email-item {
        grid-template-columns: 24px minmax(0, 1fr) 54px;
        gap: 8px;
        min-height: 64px;
    }

    .sender {
        grid-column: 2;
    }

    .message-line {
        grid-column: 2 / 4;
        grid-row: 2;
    }

    .email-detail.is-open {
        inset: 84px 10px 10px;
    }
}
