/* 智通运企业邮箱 — QQ 邮箱风格主题 */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
    font-size: 14px; color: #333; background: #f5f6f7;
    -webkit-font-smoothing: antialiased;
}
a { color: #2a7de1; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 布局骨架 ===== */
.app-shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
    width: 230px; flex: 0 0 230px; background: #f7f8fa; border-right: 1px solid #e8e9eb;
    display: flex; flex-direction: column; overflow-y: auto; z-index: 30;
}
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.content { flex: 1; overflow-y: auto; background: #fff; }
.sidebar-overlay { display: none; }

.brand { display: flex; align-items: center; gap: 8px; padding: 18px 16px 12px; }
.brand-icon { color: #2a7de1; display: inline-flex; }
.brand-text { font-size: 16px; font-weight: 600; color: #1a1a1a; white-space: nowrap; }

.compose-btn {
    margin: 4px 16px 12px; padding: 10px 0; border: none; border-radius: 20px; cursor: pointer;
    background: linear-gradient(135deg, #3d8ef0, #2a7de1); color: #fff; font-size: 15px;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    box-shadow: 0 2px 8px rgba(42, 125, 225, .35);
}
.compose-btn:hover { filter: brightness(1.05); }

.folder-nav { flex: 1; padding: 0 8px; }
.folder-item {
    display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 6px;
    cursor: pointer; color: #444; user-select: none;
}
.folder-item:hover { background: #eceff3; }
.folder-item.active { background: #e3f0fd; color: #2a7de1; font-weight: 500; }
.folder-icon { display: inline-flex; width: 20px; justify-content: center; }
.folder-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-badge {
    min-width: 20px; padding: 1px 6px; border-radius: 10px; background: #f5222d; color: #fff;
    font-size: 12px; text-align: center; line-height: 18px;
}
.folder-actions { display: none; gap: 2px; }
.folder-item:hover .folder-actions { display: inline-flex; }
.folder-add { color: #2a7de1; }

.side-bottom { padding: 8px; border-top: 1px solid #e8e9eb; margin-bottom: 8px; }
.side-link {
    display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 6px; color: #555;
}
.side-link:hover { background: #eceff3; text-decoration: none; }
.side-link.active { background: #e3f0fd; color: #2a7de1; }

/* ===== 顶栏 ===== */
.topbar {
    height: 56px; flex: 0 0 56px; background: #fff; border-bottom: 1px solid #e8e9eb;
    display: flex; align-items: center; gap: 10px; padding: 0 16px;
}
.search-box { display: flex; align-items: center; flex: 1; max-width: 420px; }
.search-box input {
    flex: 1; height: 34px; border: 1px solid #d9d9d9; border-right: none;
    border-radius: 6px 0 0 6px; padding: 0 12px; font-size: 14px; outline: none; background: #fafafa;
}
.search-box input:focus { border-color: #2a7de1; background: #fff; }
.search-box .icon-btn { border: 1px solid #d9d9d9; border-radius: 0 6px 6px 0; width: 40px; height: 34px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-chip {
    max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: #555; font-size: 13px;
}
.menu-btn { display: none; }

/* ===== 通用控件 ===== */
.icon-btn {
    border: none; background: transparent; cursor: pointer; color: #666;
    width: 34px; height: 34px; border-radius: 6px; display: inline-flex;
    align-items: center; justify-content: center; padding: 0;
}
.icon-btn:hover { background: #eceff3; color: #2a7de1; }
.btn {
    display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border-radius: 6px;
    border: 1px solid #d0d3d6; background: #fff; color: #444; cursor: pointer; font-size: 14px;
    white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: #2a7de1; color: #2a7de1; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: #2a7de1; border-color: #2a7de1; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1e6fd9; color: #fff; }
.btn-danger { color: #e5493a; border-color: #f0b7b1; }
.btn-danger:hover:not(:disabled) { background: #fdf0ef; border-color: #e5493a; color: #e5493a; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.input {
    height: 34px; border: 1px solid #d9d9d9; border-radius: 6px; padding: 0 10px;
    font-size: 14px; outline: none; width: 100%; background: #fff; color: #333;
}
.input:focus { border-color: #2a7de1; box-shadow: 0 0 0 2px rgba(42, 125, 225, .12); }
.input-sm { height: 30px; width: auto; }
.check-label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; color: #555; }
.check-label input { accent-color: #2a7de1; }
.mini-btn {
    border: none; background: transparent; cursor: pointer; color: #999; padding: 2px;
    display: inline-flex; align-items: center; border-radius: 4px;
}
.mini-btn:hover { color: #2a7de1; background: #dcebfa; }
.mini-del { color: #e5493a; }
.spin { display: inline-flex; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 邮件列表 ===== */
.mail-page { display: flex; flex-direction: column; min-height: 100%; }
.mail-toolbar {
    display: flex; align-items: center; gap: 8px; padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0; flex-wrap: wrap;
}
.toolbar-right { margin-left: auto; }
.mail-list-head { padding: 12px 16px 4px; }
.mail-list-head h2 { margin: 0; font-size: 17px; color: #1a1a1a; }
.mail-list { flex: 1; }
.mail-row {
    display: grid; grid-template-columns: 36px 34px minmax(120px, 200px) 1fr auto auto;
    align-items: center; gap: 4px; padding: 10px 12px; border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
}
.mail-row:hover { background: #f5f9ff; }
.mail-row.selected { background: #eaf4fe; }
.mail-check { display: flex; justify-content: center; }
.mail-check input { accent-color: #2a7de1; width: 16px; height: 16px; }
.star-btn { border: none; background: transparent; cursor: pointer; color: #c9c9c9; display: inline-flex; padding: 4px; }
.star-btn.starred { color: #f7a600; }
.mail-from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #555; font-size: 14px; }
.mail-row.unread .mail-from, .mail-row.unread .subject-text { font-weight: 600; color: #1a1a1a; }
.mail-subject { display: flex; gap: 8px; align-items: baseline; overflow: hidden; white-space: nowrap; }
.subject-text { max-width: 50%; overflow: hidden; text-overflow: ellipsis; }
.snippet-text { color: #999; font-size: 13px; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.mail-row.unread .subject-text::before {
    content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    background: #2a7de1; margin-right: 6px; vertical-align: middle;
}
.mail-att { color: #aaa; display: inline-flex; }
.mail-date { color: #999; font-size: 13px; white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px; border-top: 1px solid #f0f0f0; }
.pager-info { color: #888; font-size: 13px; }

/* ===== 读信 ===== */
.detail-page { padding: 16px; max-width: 900px; margin: 0 auto; }
.detail-toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.detail-card { background: #fff; border: 1px solid #ececec; border-radius: 8px; padding: 20px 24px; }
.detail-subject { margin: 0 0 12px; font-size: 19px; color: #1a1a1a; }
.detail-meta { border-bottom: 1px solid #f0f0f0; padding-bottom: 12px; margin-bottom: 12px; color: #555; font-size: 13px; }
.meta-row { margin: 4px 0; word-break: break-all; }
.meta-label { color: #999; }
.detail-attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.att-chip {
    display: inline-flex; align-items: center; gap: 6px; border: 1px solid #e0e0e0; border-radius: 6px;
    padding: 6px 10px; background: #fafafa; cursor: pointer; color: #555; font-size: 13px;
}
.att-chip:hover { border-color: #2a7de1; color: #2a7de1; }
.att-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { color: #999; }
.mail-frame { width: 100%; border: none; height: calc(100vh - 340px); min-height: 360px; }
.mail-text { white-space: pre-wrap; word-break: break-word; line-height: 1.7; margin: 0; font-family: inherit; font-size: 15px; }

/* ===== 写信 ===== */
.compose-page { height: 100%; display: flex; flex-direction: column; }
.compose-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #f0f0f0; }
.compose-head h2 { margin: 0; font-size: 16px; }
.compose-form { flex: 1; display: flex; flex-direction: column; padding: 12px 16px; gap: 8px; overflow-y: auto; }
.compose-row { display: flex; align-items: center; gap: 8px; }
.compose-row > label { flex: 0 0 60px; color: #666; text-align: right; }
.compose-row > .input { flex: 1; }
.compose-cc-toggle { display: flex; gap: 6px; }
.compose-cc-toggle button { border: none; background: transparent; color: #2a7de1; cursor: pointer; font-size: 13px; }
.compose-attachments { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-left: 68px; }
.att-upload { cursor: pointer; }
.att-total { color: #999; font-size: 12px; }
.compose-actions { display: flex; gap: 10px; padding-top: 4px; }

.rte { flex: 1; display: flex; flex-direction: column; border: 1px solid #e3e3e3; border-radius: 6px; overflow: hidden; min-height: 220px; }
.rte-toolbar { display: flex; align-items: center; gap: 2px; padding: 6px 8px; border-bottom: 1px solid #eee; background: #fafafa; }
.rte-toolbar button { border: none; background: transparent; cursor: pointer; padding: 4px 8px; border-radius: 4px; color: #555; font-size: 13px; }
.rte-toolbar button:hover { background: #e3f0fd; color: #2a7de1; }
.rte-sep { width: 1px; height: 16px; background: #e0e0e0; margin: 0 6px; }
.rte-editor { flex: 1; padding: 12px 14px; overflow-y: auto; outline: none; font-size: 15px; line-height: 1.7; min-height: 160px; }
.rte-editor:empty::before { content: "在这里撰写邮件内容…"; color: #bbb; }

/* ===== 普通页面 ===== */
.page { padding: 20px 24px; max-width: 1000px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.page-head h2 { margin: 0; font-size: 18px; }
.page-desc { color: #888; margin: 0 0 14px; line-height: 1.6; }
.page-loading { padding: 40px; text-align: center; color: #999; }
.empty-state { text-align: center; color: #999; padding: 48px 16px; }
.empty-icon { color: #d5d5d5; display: inline-flex; margin-bottom: 8px; }
.card { background: #fff; border: 1px solid #eee; border-radius: 8px; padding: 16px 18px; margin-bottom: 14px; }
.card-title { margin: 0 0 4px; font-size: 15px; }
.card-desc { margin: 0 0 10px; color: #888; font-size: 13px; line-height: 1.6; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; color: #888; font-weight: 500; padding: 8px 10px; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.table td { padding: 10px; border-bottom: 1px solid #f7f7f7; }
.mono { font-family: Consolas, monospace; font-size: 13px; }
.err-cell { color: #e5493a; font-size: 12px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { white-space: nowrap; display: flex; gap: 6px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form .input { flex: 1; min-width: 160px; }
.input-note { max-width: 200px; flex: 0 1 200px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.form-sm { max-width: 140px; }
.form-item { margin: 8px 0; }
.form-item > label { display: block; color: #666; font-size: 13px; margin-bottom: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 10px; }
.form-error { color: #e5493a; font-size: 13px; margin: 6px 0; }
.hint { color: #999; font-size: 12px; margin-left: 8px; }
.radio-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 8px 0; }
.tag { display: inline-block; background: #f0f2f4; color: #555; border-radius: 4px; padding: 2px 8px; font-size: 12px; margin: 2px 3px 2px 0; }
.tag-blue { background: #e3f0fd; color: #2a7de1; }
.tag-red { background: #fdf0ef; color: #e5493a; }
.badge { background: #f0f2f4; color: #777; border-radius: 10px; padding: 1px 8px; font-size: 12px; }
.badge-gray { background: #e8e8e8; color: #999; }
.rule-card .rule-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rule-card .rule-head strong { font-size: 15px; }
.rule-actions { margin-left: auto; display: flex; gap: 6px; }
.rule-body { margin-top: 8px; color: #666; font-size: 13px; line-height: 1.8; }
.rule-card.disabled { opacity: .6; }
.cond-row { display: flex; gap: 8px; margin: 6px 0; align-items: center; }
.cond-row .input { flex: 1; }
.modal-section { margin: 14px 0 6px; font-size: 14px; color: #444; display: flex; align-items: center; gap: 8px; }
.inline-checks { display: flex; gap: 16px; flex-wrap: wrap; margin: 6px 0; }
.radio-inline { margin-left: 4px; }
.advanced { margin-top: 10px; color: #666; }
.advanced summary { cursor: pointer; color: #2a7de1; font-size: 13px; }
.test-result { background: #f7f9fb; border: 1px solid #eee; border-radius: 6px; padding: 8px 10px; font-size: 13px; margin-top: 10px; line-height: 1.8; }

/* ===== 弹窗 ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex;
    align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal { background: #fff; border-radius: 10px; width: 520px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 8px 40px rgba(0, 0, 0, .2); }
.modal-sm { width: 380px; }
.modal-lg { width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 10px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 4px 18px 12px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px 16px; border-top: 1px solid #f0f0f0; }
.foot-spacer { margin-right: auto; }

/* ===== 登录 ===== */
.login-page {
    min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: linear-gradient(160deg, #2a7de1 0%, #1557b0 60%, #0d3f86 100%); padding: 20px;
}
.login-card { background: #fff; border-radius: 12px; padding: 30px 34px; width: 380px; max-width: 100%; box-shadow: 0 12px 50px rgba(0, 0, 0, .3); }
.login-brand { text-align: center; margin-bottom: 18px; }
.login-logo { color: #2a7de1; display: inline-flex; }
.login-brand h1 { font-size: 20px; margin: 6px 0 2px; }
.login-brand p { color: #999; margin: 0; font-size: 12px; }
.login-tabs { display: flex; border-bottom: 1px solid #eee; margin-bottom: 16px; }
.login-tab { flex: 1; border: none; background: transparent; padding: 9px 0; cursor: pointer; color: #888; font-size: 14px; }
.login-tab.active { color: #2a7de1; border-bottom: 2px solid #2a7de1; font-weight: 500; }
.login-server { text-align: center; margin-top: 12px; color: #999; font-size: 12px; }
.login-footer { color: rgba(255, 255, 255, .75); margin-top: 18px; font-size: 13px; }

/* ===== 看板 ===== */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.stat-card { background: #fff; border: 1px solid #eee; border-radius: 8px; padding: 16px; }
.stat-value { font-size: 24px; font-weight: 600; color: #1a1a1a; }
.stat-value.stat-blue { color: #2a7de1; }
.stat-label { color: #888; font-size: 12px; margin-top: 4px; }
.quota-bar-wrap { margin-bottom: 14px; }
.quota-bar { height: 10px; background: #f0f0f0; border-radius: 5px; overflow: hidden; }
.quota-fill { height: 100%; background: linear-gradient(90deg, #3d8ef0, #2a7de1); border-radius: 5px; transition: width .3s; }
.bar-col { width: 220px; }
.mini-bar { height: 8px; background: #f5f5f5; border-radius: 4px; overflow: hidden; }
.mini-bar-fill { height: 100%; background: #7fb1f0; border-radius: 4px; }
.sync-status { color: #888; font-size: 13px; }

/* ===== 提示 ===== */
.toast {
    position: fixed; top: 16px; left: 50%; transform: translateX(-50%); background: #333; color: #fff;
    padding: 10px 22px; border-radius: 6px; z-index: 200; font-size: 14px; box-shadow: 0 4px 20px rgba(0, 0, 0, .25);
    animation: toast-in .2s ease-out;
}
.toast-error { background: #e5493a; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ===== 移动端适配 ===== */
@media (max-width: 900px) {
    .menu-btn { display: inline-flex; }
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 2px 0 12px rgba(0, 0, 0, .08); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 25; }
    .mail-row { grid-template-columns: 30px 30px 1fr auto; grid-template-areas: "chk star from date" ". sub sub sub"; row-gap: 2px; }
    .mail-check { grid-area: chk; }
    .mail-row .star-btn { grid-area: star; }
    .mail-from { grid-area: from; }
    .mail-subject { grid-area: sub; }
    .mail-date { grid-area: date; }
    .mail-att { display: none; }
    .snippet-text { display: none; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .detail-page, .page { padding: 12px; }
    .compose-row > label { flex-basis: 48px; font-size: 13px; }
    .compose-attachments { padding-left: 0; }
    .bar-col { width: 90px; }
    .table th:nth-child(5), .table td:nth-child(5) { display: none; }
    .user-chip { display: none; }
    .search-box { max-width: none; }
}
