:root {
    --bg: #f4f5f7;
    --card-bg: #ffffff;
    --text: #1f2328;
    --muted: #6b7280;
    --accent: #2563eb;
    --border: #e2e4e8;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    color: var(--text);
}

nav a {
    margin-left: 16px;
    text-decoration: none;
    color: var(--accent);
    font-size: 0.9rem;
}

.flash-container {
    max-width: 700px;
    margin: 12px auto 0;
    padding: 0 16px;
}

.flash {
    background: #fff7e6;
    border: 1px solid #ffd591;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
}

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 16px 20px;
}

.columns {
    display: flex;
    gap: 16px;
    height: calc(100vh - 130px);
}

.column {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-width: 0;
    background: #eef0f3;
    border-radius: 12px;
    overflow: hidden;
    transition: flex 0.25s ease;
}

.column.is-expanded {
    flex: 3.2 1 0;
}

.column.is-shrunk {
    flex: 0.55 1 0;
}

.column-title {
    margin: 0;
    padding: 12px 14px;
    font-size: 0.95rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.column-title:hover {
    background: #f8fafc;
}

.column-title .hint {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 400;
    white-space: nowrap;
}

.feed {
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px;
    flex: 1;
    min-width: 0;
}

@media (max-width: 900px) {
    .columns {
        flex-direction: column;
        height: auto;
    }
    .column, .column.is-expanded, .column.is-shrunk {
        flex: none;
        height: 60vh;
    }
}

.mail-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    min-width: 0;
    overflow-wrap: anywhere;
}

.mail-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.mail-header h3 {
    font-size: 1rem;
    margin: 0;
}

.mail-header time {
    font-size: 0.8rem;
    color: var(--muted);
    white-space: nowrap;
}

.mail-body {
    line-height: 1.55;
    font-size: 0.96rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.mail-body img { max-width: 100%; border-radius: 6px; }
.mail-body p:first-child { margin-top: 0; }
.mail-body pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow-x: auto;
    background: #f4f5f7;
    padding: 8px;
    border-radius: 6px;
}
.mail-body table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
}

.attachments {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    background: #eef2ff;
    color: var(--accent);
    padding: 5px 10px;
    border-radius: 8px;
    text-decoration: none;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment:hover { background: #e0e7ff; }

.empty {
    text-align: center;
    color: var(--muted);
    margin-top: 60px;
}

.admin-form, .login-form {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    max-width: 560px;
    margin: 20px auto;
}

.admin-form label, .login-form label {
    display: block;
    margin-top: 14px;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: var(--muted);
}

.admin-form input[type="text"],
.admin-form textarea,
.admin-form input[type="file"],
.login-form input[type="password"] {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
}

.admin-form textarea {
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.88rem;
}

button {
    margin-top: 18px;
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
}

button:hover { background: #1d4ed8; }
