@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&family=Source+Serif+4:wght@400;600&display=swap');

:root {
    --bg: #f6f3ef;
    --panel: #ffffff;
    --ink: #1e1f22;
    --muted: #6a6f76;
    --accent: #1a6b8f;
    --accent-strong: #0b4b66;
    --border: #e2ddd8;
    --shadow: 0 20px 50px rgba(30, 31, 34, 0.08);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--ink);
    background: radial-gradient(circle at 10% 10%, #fff6ea 0%, #f6f3ef 40%, #eef3f5 100%);
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    font-family: 'Source Serif 4', serif;
    margin: 0;
}

button, input, select, textarea {
    font-family: inherit;
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.auth-card {
    background: var(--panel);
    padding: 36px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 440px;
    width: 100%;
}

.brand {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
}

.logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1a6b8f, #6fb1c4);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 600;
}

.stack {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 8px;
    font-size: 14px;
    color: var(--muted);
}

input, textarea, select {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
    font-size: 15px;
}

input:focus, textarea:focus, select:focus {
    outline: 2px solid rgba(26, 107, 143, 0.2);
    border-color: var(--accent);
}

.btn {
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn.primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 10px 20px rgba(26, 107, 143, 0.2);
}

.btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(26, 107, 143, 0.25);
}

.btn.ghost {
    background: transparent;
    color: var(--accent-strong);
    border: 1px solid var(--border);
}

.hint {
    color: var(--muted);
    font-size: 13px;
}

.error {
    color: #b23b3b;
    font-size: 13px;
}

.app-shell {
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 100vh;
}
.settings-shell {
    min-height: 100vh;
    padding: 32px;
    display: grid;
    gap: 24px;
}
.settings-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}
.settings-header p {
    margin: 6px 0 0;
    color: var(--muted);
}
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.settings-card {
    background: var(--panel);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: grid;
    gap: 14px;
}
.settings-card h2 {
    margin: 0;
}

.sidebar {
    padding: 24px;
    display: grid;
    gap: 20px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border);
}

.sidebar-header {
    display: flex;
    gap: 14px;
    align-items: center;
}

.sidebar-header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.panel {
    display: grid;
    gap: 10px;
}

.panel-title {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    color: var(--muted);
}

.list {
    display: grid;
    gap: 8px;
}

.list-item {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
}

.list-item.active {
    border-color: var(--accent);
    background: #eef7fb;
}

.content {
    display: grid;
    grid-template-rows: auto 1fr;
    padding: 24px;
    gap: 20px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.toolbar .search input {
    width: 320px;
}

.status {
    color: var(--muted);
    font-size: 13px;
}
.status.success {
    color: #0b7a3a;
}
.status.error {
    color: #b23b3b;
}
.muted {
    color: var(--muted);
    font-size: 13px;
}

.mail-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    height: 100%;
}

.mail-list {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow);
    overflow: auto;
}

.mail-card {
    border-bottom: 1px solid var(--border);
    padding: 12px;
    cursor: pointer;
}

.mail-card:last-child {
    border-bottom: none;
}

.mail-card h4 {
    margin: 0 0 6px;
    font-size: 14px;
}

.mail-card p {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.mail-view {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    overflow: auto;
}

.mail-view .empty {
    color: var(--muted);
}

.mail-body {
    line-height: 1.6;
}

.mail-view hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

.modal, .composer {
    position: fixed;
    inset: 0;
    background: rgba(30, 31, 34, 0.35);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-card, .composer-card {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    width: min(520px, 90vw);
}
.tabs {
    display: flex;
    gap: 8px;
    margin: 12px 0 16px;
}
.tab {
    border: 1px solid var(--border);
    background: #fff;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}
.tab.active {
    background: #eef7fb;
    border-color: var(--accent);
    color: var(--accent-strong);
}
.grid-2 {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 720px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

.composer {
    align-items: stretch;
    justify-content: flex-end;
}

.composer-card {
    width: min(520px, 100%);
    height: 100%;
    border-radius: 0;
}

.composer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.between {
    justify-content: space-between;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
    .sidebar {
        grid-template-columns: 1fr 1fr;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .content {
        padding: 16px;
    }
    .mail-layout {
        grid-template-columns: 1fr;
    }
    .toolbar .search input {
        width: 100%;
    }
}

@media (max-width: 720px) {
    .sidebar {
        grid-template-columns: 1fr;
    }
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .composer-card {
        width: 100%;
    }
}
