/* ==========================================================================
   企业邮箱门户 —— 设计规范（基于 Fluent 2 设计令牌，对标 Microsoft 365）
   所有颜色、字号、圆角、阴影均取自 Fluent 令牌，括号内为令牌未加载时的回退值。
   ========================================================================== */
@import url('/_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css');

:root {
    --header-height: 48px;
    --rail-width: 68px;
    --pane-border: 1px solid var(--colorNeutralStroke2, #e0e0e0);
    --surface: var(--colorNeutralBackground1, #fff);
    --surface-alt: var(--colorNeutralBackground2, #fafafa);
    --canvas: var(--colorNeutralBackground3, #f5f5f5);
    --fg1: var(--colorNeutralForeground1, #242424);
    --fg2: var(--colorNeutralForeground2, #424242);
    --fg3: var(--colorNeutralForeground3, #616161);
    --fg4: var(--colorNeutralForeground4, #707070);
    --brand: var(--colorBrandBackground, #0f6cbd);
    --brand-hover: var(--colorBrandBackgroundHover, #115ea3);
    --brand-fg: var(--colorBrandForeground1, #0f6cbd);
    --brand-soft: var(--colorBrandBackground2, #ebf3fc);
    --hover: var(--colorSubtleBackgroundHover, #f5f5f5);
    --selected: var(--colorNeutralBackground1Selected, #ebebeb);
    --danger: var(--colorPaletteRedForeground1, #bc2f32);
    --success: var(--colorPaletteGreenForeground1, #0e700e);
    --warning: var(--colorPaletteDarkOrangeForeground1, #bc4b09);
    --radius: var(--borderRadiusMedium, 4px);
    --radius-lg: var(--borderRadiusXLarge, 8px);
    --shadow-card: var(--shadow4, 0 0 2px rgba(0,0,0,.12), 0 2px 4px rgba(0,0,0,.14));
    --shadow-flyout: var(--shadow16, 0 0 2px rgba(0,0,0,.12), 0 8px 16px rgba(0,0,0,.14));
    --font: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
input, textarea, select, button { font: inherit; color: inherit; }
a { color: var(--brand-fg); }
[hidden] { display: none !important; }
body {
    font-family: var(--font);
    font-size: var(--fontSizeBase300, 14px);
    line-height: var(--lineHeightBase300, 20px);
    color: var(--fg1);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
}
h1:focus, h1:focus-visible { outline: none; }
.muted { color: var(--fg3); }
.small { font-size: var(--fontSizeBase200, 12px); line-height: 16px; }
.spacer { flex: 1; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -------------------------------------------------------------------------- 顶部品牌栏 */
.app-shell { display: flex; flex-direction: column; height: 100vh; }
.app-header {
    height: var(--header-height); flex: none; display: flex; align-items: center; gap: 12px; padding: 0 8px 0 4px;
    background: var(--brand); color: var(--colorNeutralForegroundOnBrand, #fff); position: relative; z-index: 20;
}
.app-header-start { display: flex; align-items: center; gap: 4px; min-width: 260px; }
.app-header .header-btn { color: inherit; }
.app-header .header-btn::part(control), .app-header .header-btn { --colorNeutralForeground1: #fff; --colorNeutralForeground2: #fff; }
.app-brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; height: 48px; padding: 0 8px; }
.app-brand img { height: 24px; width: auto; max-width: 150px; }
/* 标识与产品名：底部对齐到标识字母的基线（标识上方有弧线，居中对齐会显得文字偏高），中间加细分隔线 */
.brand-lockup { display: inline-flex; align-items: flex-end; gap: 10px; }
.brand-lockup img { display: block; }
/* 产品名、分隔线、栏目名（如“管理中心”）三者按中线对齐，整组再落在标识字母的基线上 */
.brand-lockup-text { display: inline-flex; align-items: center; gap: 10px; transform: translateY(.03em); }
.brand-lockup-name { font-size: 17px; font-weight: 600; line-height: 1; letter-spacing: 1px; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.55); white-space: nowrap; }
.app-brand-sep { width: 1px; height: 17px; background: rgba(255,255,255,.55); }
.app-brand-section { font-size: 17px; line-height: 1; letter-spacing: 1px; white-space: nowrap; }
.app-header-spacer { flex: 1; }
.app-header-search {
    flex: 1; max-width: 560px; margin: 0 auto; height: 32px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 10px;
    background: rgba(255,255,255,.92); border-radius: var(--radius); color: var(--fg2);
}
.app-header-search:focus-within { background: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.app-header-search input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; color: var(--fg1); }
.app-header-search .search-clear { border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--fg3); }
.app-header-end { display: flex; align-items: center; gap: 4px; min-width: 260px; justify-content: flex-end; }
.profile-button { border: 0; background: transparent; padding: 0 4px; height: 48px; cursor: pointer; display: grid; place-items: center; }
.profile-button:hover { background: rgba(0,0,0,.12); }
.profile-card { width: 340px; }
.profile-card-top { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 12px 8px; }
.profile-card-main { display: flex; gap: 16px; padding: 8px 8px 12px; }
.profile-name { font-size: 18px; font-weight: 600; line-height: 24px; }
.profile-mail { color: var(--fg3); margin-bottom: 6px; }

/* -------------------------------------------------------------------------- 应用栏与内容 */
.app-body { flex: 1; display: flex; min-height: 0; }
.app-rail {
    width: var(--rail-width); flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0;
    background: var(--canvas); border-right: var(--pane-border);
}
.app-rail-item {
    width: 60px; padding: 8px 0 6px; border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--fg2); text-decoration: none; font-size: 11px; position: relative;
}
.app-rail-item:hover { background: var(--hover); color: var(--fg1); }
.app-rail-item.active { color: var(--brand-fg); background: var(--surface); box-shadow: var(--shadow-card); font-weight: 600; }
.app-rail-item.active::before { content: ""; position: absolute; left: -4px; top: 12px; bottom: 12px; width: 3px; border-radius: 2px; background: var(--brand); }
.app-rail-spacer { flex: 1; }
.app-content { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface); }

/* -------------------------------------------------------------------------- 命令栏（简化功能区） */
.command-bar {
    height: 44px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 8px;
    border-bottom: var(--pane-border); background: var(--surface); overflow: hidden;
}
.command-bar .divider { width: 1px; height: 20px; background: var(--colorNeutralStroke2, #e0e0e0); margin: 0 6px; }
.command-bar fluent-button, .command-bar .fluent-button { white-space: nowrap; }

/* -------------------------------------------------------------------------- 通用面板 */
.pane { display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.pane-header { padding: 14px 16px 10px; display: flex; align-items: center; gap: 8px; }
.pane-title { font-size: 18px; font-weight: 600; line-height: 24px; }
.pane-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.section-label { font-size: 12px; font-weight: 600; color: var(--fg3); padding: 12px 16px 4px; text-transform: none; }

.empty-state { flex: 1; min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--fg3); padding: 24px; text-align: center; }
.empty-state .empty-title { font-size: 16px; font-weight: 600; color: var(--fg2); }

/* -------------------------------------------------------------------------- 卡片与页面（管理中心） */
.page { flex: 1; overflow-y: auto; padding: 24px 32px 40px; background: var(--canvas); }
.page-header { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.page-header h1 { font-size: 24px; line-height: 32px; font-weight: 600; margin: 0; }
.page-header .page-desc { color: var(--fg3); margin-top: 4px; max-width: 760px; }
.card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 16px 20px; }
.card-title { font-size: 16px; font-weight: 600; line-height: 22px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card-grid { display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-6 { grid-column: span 6; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
@media (max-width: 1200px) { .span-3 { grid-column: span 6; } .span-4, .span-8 { grid-column: span 12; } .span-6 { grid-column: span 12; } }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; }
.kv dt { color: var(--fg3); }
.kv dd { margin: 0; }

.persona { display: inline-grid; place-items: center; flex: none; border-radius: 50%; font-weight: 600; letter-spacing: 0; user-select: none; line-height: 1; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--fg4); vertical-align: middle; margin-right: 6px; }
.status-dot.ok { background: #13a10e; } .status-dot.warn { background: #f7630c; } .status-dot.err { background: #d13438; }

/* -------------------------------------------------------------------------- 登录与初始化 */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.auth-hero {
    position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column;
    background: radial-gradient(1200px 600px at 0% 100%, rgba(255,255,255,.14), transparent 60%),
                linear-gradient(135deg, var(--brand) 0%, #0b4a8b 55%, #082f5c 100%);
}
.auth-hero .hero-brand { gap: 14px; }
.auth-hero .hero-brand img { height: 36px; }
.auth-hero .hero-brand .brand-lockup-name { font-size: 22px; padding-left: 14px; }
.auth-hero .hero-text { margin-top: auto; max-width: 460px; }
.auth-hero .hero-title { font-size: 34px; line-height: 44px; font-weight: 600; margin: 0 0 12px; }
.auth-hero .hero-sub { font-size: 16px; line-height: 24px; opacity: .85; }
.auth-hero .hero-features { display: flex; gap: 28px; margin-top: 40px; opacity: .9; font-size: 13px; }
.auth-hero .hero-features div { display: flex; align-items: center; gap: 8px; }
.auth-hero::after { content: ""; position: absolute; right: -120px; top: -120px; width: 420px; height: 420px; border-radius: 50%; border: 1px solid rgba(255,255,255,.15); }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 48px; }
.auth-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.auth-form h1 { font-size: 24px; line-height: 32px; font-weight: 600; margin: 0; }
.auth-foot { color: var(--fg4); font-size: 12px; margin-top: 24px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label { font-weight: 600; font-size: 14px; }
.auth-input {
    height: 36px; padding: 0 10px; font: inherit; color: var(--fg1); background: var(--surface);
    border: 1px solid var(--colorNeutralStroke1, #d1d1d1); border-bottom-color: var(--colorNeutralStrokeAccessible, #616161); border-radius: var(--radius); outline: none;
}
.auth-input:hover { border-color: var(--colorNeutralStroke1Hover, #c7c7c7); border-bottom-color: var(--colorNeutralStrokeAccessibleHover, #575757); }
.auth-input:focus { border-bottom: 2px solid var(--brand); padding-bottom: 0; }
.auth-remember { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--fg2); }
.auth-submit { height: 40px; }
@media (max-width: 900px) { .auth-page { grid-template-columns: 1fr; } .auth-hero { display: none; } }

/* ---------------- 初始化向导（沿用登录页的左右布局） ---------------- */
.setup-steps { list-style: none; margin: 40px 0 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.setup-steps li { display: flex; gap: 14px; position: relative; padding-bottom: 22px; opacity: .65; }
.setup-steps li:last-child { padding-bottom: 0; }
.setup-steps li:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; background: rgba(255,255,255,.25); }
.setup-steps li.on, .setup-steps li.done { opacity: 1; }
.setup-num { width: 28px; height: 28px; flex: none; border-radius: 50%; border: 2px solid rgba(255,255,255,.7); display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.setup-steps li.on .setup-num { background: #fff; color: var(--brand); border-color: #fff; }
.setup-steps li.done .setup-num { background: rgba(255,255,255,.22); border-color: transparent; }
.setup-step-text { display: flex; flex-direction: column; gap: 2px; padding-top: 3px; }
.setup-step-text b { font-size: 15px; font-weight: 600; }
.setup-step-text small { font-size: 12px; opacity: .8; }
.setup-form { max-width: 420px; }
.setup-form .auth-field small { font-size: 12px; line-height: 18px; }
.setup-count { font-size: 12px; color: var(--brand-fg); font-weight: 600; margin-bottom: 6px; }
.setup-readonly { height: 34px; display: flex; align-items: center; padding: 0 10px; background: var(--surface-alt); border-radius: var(--radius); color: var(--fg2); font-family: "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.setup-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.setup-file { font-size: 13px; }
.setup-log { list-style: none; margin: 0; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-alt); border-radius: var(--radius-lg); max-height: 320px; overflow: auto; font-size: 13px; color: var(--fg2); }
.setup-log li { display: flex; align-items: center; gap: 8px; }
.setup-log li::before { content: none !important; }
.setup-summary { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 13px; }
.setup-summary dt { color: var(--fg3); font-weight: 400; }
.setup-summary dd { margin: 0; font-weight: 600; }
.choice-text { display: flex; flex-direction: column; gap: 2px; }
.choice-text small { font-size: 12px; line-height: 18px; }
.pw-meter { height: 4px; border-radius: 2px; background: var(--colorNeutralStroke3, #f0f0f0); overflow: hidden; }
.pw-meter i { display: block; height: 100%; transition: width .2s; }
.pw-meter .pw-1 { background: var(--danger); }
.pw-meter .pw-2 { background: var(--warning); }
.pw-meter .pw-3, .pw-meter .pw-4 { background: var(--success); }

/* ---------------- 附件预览（全屏查看器） ---------------- */
.viewer { position: fixed; inset: 0; z-index: 900; display: flex; flex-direction: column; background: rgba(20,20,20,.94); outline: none; animation: viewer-in .12s ease-out; }
@keyframes viewer-in { from { opacity: 0; } }
.viewer-head { height: 56px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 12px 0 16px; color: #fff; background: rgba(0,0,0,.35); }
.viewer-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius); background: rgba(255,255,255,.12); margin-right: 6px; }
.viewer-title { display: flex; flex-direction: column; min-width: 0; }
.viewer-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50vw; }
.viewer-meta { font-size: 12px; opacity: .7; }
.viewer-btn { height: 32px; min-width: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: var(--radius); background: transparent; color: #fff; font: inherit; font-size: 13px; cursor: pointer; text-decoration: none; }
.viewer-btn.wide { padding: 0 12px; background: rgba(255,255,255,.12); }
.viewer-btn:hover { background: rgba(255,255,255,.2); }
.viewer-zoom { color: #fff; font-size: 12px; min-width: 40px; text-align: center; opacity: .85; font-variant-numeric: tabular-nums; }
.viewer-sep { width: 1px; height: 20px; background: rgba(255,255,255,.25); margin: 0 6px; }
.viewer-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 24px; overflow: auto; }
.viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 8px 32px rgba(0,0,0,.5); transition: transform .15s; }
.viewer-body video { max-width: 100%; max-height: 100%; }
.viewer-doc { width: min(1100px, 100%); height: 100%; border: 0; border-radius: var(--radius); background: #fff; box-shadow: 0 8px 32px rgba(0,0,0,.5); }
.viewer-card { background: var(--surface); border-radius: var(--radius-lg); padding: 36px 48px; display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 440px; text-align: center; box-shadow: var(--shadow-flyout); }
.viewer-card-name { font-weight: 600; font-size: 15px; word-break: break-all; }

/* 未处理错误提示条（Blazor 默认元素） */
#blazor-error-ui { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; padding: 10px 48px 10px 16px; background: var(--colorPaletteRedBackground1, #fdf3f4); color: var(--danger); box-shadow: 0 -2px 8px rgba(0,0,0,.1); font-size: 13px; }
#blazor-error-ui .reload { margin-left: 8px; color: var(--danger); font-weight: 600; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 16px; top: 8px; }

/* 阅读区内预览附件（不弹出）：浅色，占满阅读区，顶部“返回邮件” */
.viewer.inline { position: static; inset: auto; z-index: auto; flex: 1; min-height: 0; background: var(--canvas); animation: none; }
.viewer.inline .viewer-head { color: var(--fg1, #242424); background: var(--surface); border-bottom: 1px solid var(--stroke2, #e0e0e0); }
.viewer.inline .viewer-head svg { fill: currentColor !important; color: var(--fg2, #424242) !important; }
.viewer.inline .viewer-btn, .viewer.inline .viewer-zoom { color: var(--fg1, #242424); }
.viewer.inline .viewer-btn.wide { background: var(--canvas); }
.viewer.inline .viewer-btn:hover { background: var(--hover); }
.viewer.inline .viewer-icon { background: var(--brand-soft); }
.viewer.inline .viewer-name { max-width: 30vw; }
.viewer.inline .viewer-sep { background: var(--stroke2, #e0e0e0); }
.viewer.inline .viewer-back { margin-right: 8px; color: var(--brand-fg); }
.viewer.inline .viewer-body { padding: 12px; }
.viewer.inline .viewer-doc, .viewer.inline .viewer-body img { box-shadow: var(--shadow-card); }
.viewer.inline .viewer-doc { width: 100%; }
.reading-pane .reading.previewing > .reading-head, .reading-pane .reading.previewing > .reading-scroll { display: none; }
.viewer-doc.sheet { width: 100%; }
.persona-photo { display: inline-block; object-fit: cover; background: var(--canvas); }
