/* RoboticsAINZ Mail */
:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #f2f5fa;
  --surface-3: #e9eef6;
  --text: #1f1f1f;
  --text-2: #444746;
  --muted: #5f6368;
  --line: #e3e7ee;
  --line-2: #c4c7c5;
  --accent: #0b57d0;
  --accent-2: #0842a0;
  --on-accent: #ffffff;
  --accent-soft: #d3e3fd;
  --compose: #c2e7ff;
  --compose-hover: #b3dcf7;
  --hover: rgba(60, 64, 67, .08);
  --row-read: #f2f6fc;
  --row-unread: #ffffff;
  --row-sel: #c2dbff;
  --danger: #b3261e;
  --danger-soft: #fce8e6;
  --ok: #146c2e;
  --ok-soft: #e6f4ea;
  --warn: #8a5300;
  --warn-soft: #fef7e0;
  --info-soft: #e8f0fe;
  --star: #f4b400;
  --shadow: 0 1px 3px rgba(60, 64, 67, .15), 0 4px 8px 3px rgba(60, 64, 67, .08);
  --shadow-lg: 0 8px 10px 1px rgba(0, 0, 0, .14), 0 3px 14px 2px rgba(0, 0, 0, .12), 0 5px 5px -3px rgba(0, 0, 0, .2);
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111418; --surface: #1b1f24; --surface-2: #22272e; --surface-3: #2a3038;
    --text: #e6e8eb; --text-2: #c4c7c5; --muted: #9aa0a6; --line: #2d333b; --line-2: #444a52;
    --accent: #a8c7fa; --accent-2: #c2d7fb; --on-accent: #062e6f; --accent-soft: #233a5e; --compose: #284a72; --compose-hover: #30588a;
    --hover: rgba(255, 255, 255, .07); --row-read: #181c21; --row-unread: #20252b; --row-sel: #2b3f5e;
    --danger: #f2b8b5; --danger-soft: #3b1d1b; --ok: #6dd58c; --ok-soft: #1c3424; --warn: #f6c56b; --warn-soft: #3a2e14; --info-soft: #1e2b40;
    --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 4px 8px 3px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111418; --surface: #1b1f24; --surface-2: #22272e; --surface-3: #2a3038;
  --text: #e6e8eb; --text-2: #c4c7c5; --muted: #9aa0a6; --line: #2d333b; --line-2: #444a52;
  --accent: #a8c7fa; --accent-2: #c2d7fb; --on-accent: #062e6f; --accent-soft: #233a5e; --compose: #284a72; --compose-hover: #30588a;
  --hover: rgba(255, 255, 255, .07); --row-read: #181c21; --row-unread: #20252b; --row-sel: #2b3f5e;
  --danger: #f2b8b5; --danger-soft: #3b1d1b; --ok: #6dd58c; --ok-soft: #1c3424; --warn: #f6c56b; --warn-soft: #3a2e14; --info-soft: #1e2b40;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
code { font: 12px Consolas, Menlo, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

.ic { width: 20px; height: 20px; fill: currentColor; flex: none; }
.ic.xs { width: 14px; height: 14px; vertical-align: -2px; }
.ic.big { width: 56px; height: 56px; opacity: .35; }
.ic.ok { fill: var(--ok); }

.boot { height: 100vh; display: grid; place-items: center; }
.boot img { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; transform: scale(.95); } }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 22px; border-radius: 20px; border: 0; cursor: pointer; font-weight: 600; background: transparent; color: var(--accent); white-space: nowrap; text-decoration: none; transition: background .15s, box-shadow .15s; }
.btn .ic { width: 18px; height: 18px; }
.btn.sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { box-shadow: 0 1px 3px rgba(0,0,0,.25); background: var(--accent-2); }
.btn.danger { background: var(--danger); color: #fff; }
:root[data-theme="dark"] .btn.danger { color: #3b1d1b; }
.btn.outline { border: 1px solid var(--line-2); color: var(--text-2); background: var(--surface); }
.btn.outline:hover { background: var(--hover); }
.btn.tonal { background: var(--accent-soft); color: var(--accent); }
.btn.text:hover { background: var(--hover); }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 50%; border: 0; background: transparent; color: var(--text-2); cursor: pointer; flex: none; text-decoration: none; }
.icon-btn:hover { background: var(--hover); }
.icon-btn:disabled { opacity: .35; cursor: default; background: none; }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .ic { width: 18px; height: 18px; }
.icon-btn.xs { width: 22px; height: 22px; }
.icon-btn.xs .ic { width: 14px; height: 14px; }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 4px 6px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.link-btn:hover { background: var(--hover); }
.link { font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- forms ---------- */
.field { display: block; margin: 0 0 16px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field input, .field select, .field textarea, .addr-input, .pw-input {
  width: 100%; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field select:focus, .field textarea:focus, .addr-input:focus-within, .pw-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.addr-input, .pw-input { display: flex; align-items: center; padding: 0 4px 0 12px; }
.addr-input input, .pw-input input { border: 0 !important; box-shadow: none !important; padding: 10px 0; flex: 1; min-width: 0; background: transparent; }
.addr-input .suffix { color: var(--muted); padding: 0 8px 0 2px; white-space: nowrap; }
.code-input { font: 600 22px Consolas, Menlo, monospace !important; letter-spacing: 8px; text-align: center; }
.hint { font-size: 12.5px; color: var(--muted); margin: -8px 0 16px; }
.form-err { color: var(--danger); background: var(--danger-soft); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 0 0 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.radio-group { display: grid; gap: 8px; margin: 4px 0 16px; }
.radio-group label, .check { display: flex; gap: 8px; align-items: center; cursor: pointer; margin-bottom: 8px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------- auth pages ---------- */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border-radius: 28px; padding: 36px 36px 28px; border: 1px solid var(--line); }
.auth-card.wide { max-width: 520px; }
.auth-card h1 { font-size: 26px; font-weight: 500; margin: 18px 0 6px; letter-spacing: -.2px; }
.auth-card .sub { color: var(--text-2); margin: 0 0 24px; }
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-name { font-size: 18px; color: var(--text-2); letter-spacing: -.1px; }
.brand-name b { font-weight: 600; color: var(--text); }
.auth-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; }
.auth-foot { display: flex; gap: 18px; align-items: center; color: var(--muted); font-size: 12.5px; margin-top: 18px; }
.auth-foot .link-btn { color: var(--muted); font-size: 12.5px; }
.chip-line { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: 18px; padding: 5px 14px 5px 8px; margin-bottom: 18px; font-weight: 500; }

/* ---------- app layout ---------- */
.layout { display: grid; grid-template-columns: 256px minmax(0, 1fr); grid-template-rows: 64px auto 1fr; grid-template-areas: "top top" "nav banner" "nav main"; height: 100vh; height: 100dvh; }
.layout.nav-mini { grid-template-columns: 72px minmax(0, 1fr); }
.topbar { grid-area: top; display: flex; align-items: center; gap: 4px; padding: 8px 12px 8px 8px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 0 8px; width: 228px; flex: none; }
.layout.nav-mini .brand { width: 228px; }
.search { flex: 1; min-width: 0; max-width: 720px; display: flex; align-items: center; height: 48px; background: var(--surface-3); border-radius: 24px; padding: 0 4px; transition: background .15s, box-shadow .15s; }
.search:focus-within { background: var(--surface); box-shadow: var(--shadow); }
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 16px; min-width: 0; padding: 0 4px; }
.top-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; padding-left: 8px; }
.avatar-btn { border: 0; background: none; padding: 3px; border-radius: 50%; cursor: pointer; margin-left: 4px; }
.avatar-btn:hover { background: var(--hover); }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 600; flex: none; user-select: none; }

.top-banner { grid-area: banner; display: flex; align-items: center; gap: 12px; background: var(--warn-soft); color: var(--warn); margin: 0 16px 8px 0; border-radius: 12px; padding: 6px 8px 6px 16px; font-size: 13px; }
.top-banner span { flex: 1; }

.sidenav { grid-area: nav; overflow-y: auto; padding: 8px 8px 24px 0; scrollbar-width: thin; }
.compose-btn { display: inline-flex; align-items: center; gap: 14px; height: 56px; padding: 0 24px 0 18px; margin: 0 0 12px 8px; border: 0; border-radius: 16px; background: var(--compose); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; transition: box-shadow .15s, background .15s; }
.compose-btn:hover { box-shadow: var(--shadow); background: var(--compose-hover); }
.compose-btn .ic { width: 22px; height: 22px; }
.nav-item { display: flex; align-items: center; gap: 16px; height: 32px; padding: 0 12px 0 24px; border-radius: 0 16px 16px 0; color: var(--text-2); text-decoration: none; font-size: 14px; white-space: nowrap; }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--accent-soft); color: var(--text); font-weight: 700; }
.nav-item.bold { font-weight: 700; color: var(--text); }
.nav-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-item .count { font-size: 12px; font-weight: 700; }
.nav-head { padding: 18px 24px 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.nav-item.box { height: 44px; }
.nav-item.box .label { display: flex; flex-direction: column; line-height: 1.25; }
.bx-name { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.bx-addr { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.nav-item.box.current { background: var(--surface-3); }
.layout.nav-mini .sidenav { padding-right: 0; }
.layout.nav-mini .compose-btn { width: 56px; padding: 0; justify-content: center; margin-left: 8px; }
.layout.nav-mini .compose-btn span, .layout.nav-mini .nav-item .label, .layout.nav-mini .nav-head { display: none; }
.layout.nav-mini .nav-item { width: 56px; padding: 0; justify-content: center; border-radius: 16px; margin-left: 8px; position: relative; }
.layout.nav-mini .nav-item .count { position: absolute; top: 1px; right: 2px; font-size: 10px; background: var(--danger); color: #fff; border-radius: 8px; padding: 0 4px; }
.scrim { display: none; }
.fab { display: none; }

.main { grid-area: main; min-width: 0; min-height: 0; padding: 0 16px 16px 0; }
.panel { background: var(--surface); border-radius: var(--radius); height: 100%; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.toolbar { display: flex; align-items: center; gap: 2px; height: 48px; padding: 0 8px 0 10px; flex: none; border-bottom: 1px solid transparent; }
.pager-text { font-size: 12px; color: var(--muted); padding: 0 8px; white-space: nowrap; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.empty { padding: 72px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.info-bar { font-size: 13px; color: var(--muted); padding: 8px 20px; background: var(--surface-2); text-align: center; }
.search-head { display: flex; align-items: center; gap: 8px; padding: 2px 20px 8px; color: var(--muted); font-size: 13px; }
.search-head .ic { width: 16px; height: 16px; }

/* ---------- list ---------- */
.cb { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; flex: none; }
.cb:hover { background: var(--hover); }
.rows { overflow-y: auto; flex: 1; border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 40px 32px minmax(120px, 200px) 1fr auto 84px; align-items: center; height: 40px; padding: 0 16px 0 10px; border-bottom: 1px solid var(--line); background: var(--row-read); cursor: pointer; position: relative; color: var(--text-2); }
.row.unread { background: var(--row-unread); color: var(--text); }
.row.unread .who .b, .row.unread .subj, .row.unread .when { font-weight: 700; color: var(--text); }
.row:hover { box-shadow: inset 1px 0 0 var(--line-2), inset -1px 0 0 var(--line-2), 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15); z-index: 1; }
.row.selected { background: var(--row-sel); }
.star { border: 0; background: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--muted); padding: 0; }
.star:hover { background: var(--hover); }
.star.on { color: var(--star); }
.star.big .ic { width: 22px; height: 22px; }
.who { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-right: 16px; }
.who .n { font-size: 12px; color: var(--muted); margin-left: 4px; font-weight: 400; }
.what { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
.snip { color: var(--muted); }
.att { color: var(--muted); padding: 0 8px; display: inline-flex; }
.att .ic { width: 16px; height: 16px; }
.when { font-size: 12px; text-align: right; white-space: nowrap; }
.draft-tag { color: var(--danger); font-weight: 600; margin-right: 6px; }
.ftag { font-size: 11.5px; background: var(--surface-3); color: var(--text-2); border-radius: 4px; padding: 1px 6px; margin-right: 6px; font-weight: 500; vertical-align: 1px; }
.ftag.box { background: var(--info-soft); }
.hover-acts { display: none; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: inherit; padding-left: 8px; }
.row:hover .hover-acts { display: flex; }
.row:hover .when { visibility: hidden; }

/* ---------- thread ---------- */
.thread-scroll { overflow-y: auto; flex: 1; padding: 4px 0 40px; }
.thread-head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 8px 24px 12px 72px; }
.thread-head h1 { font-size: 22px; font-weight: 400; margin: 0 10px 0 0; word-break: break-word; }
.msgs { padding: 0 16px 0 16px; }
.msg { border-bottom: 1px solid var(--line); padding: 12px 8px 12px 0; }
.msg:last-child { border-bottom: 0; }
.msg-head { display: grid; grid-template-columns: 56px 1fr auto; align-items: start; cursor: pointer; }
.msg-head .avatar { justify-self: center; }
.msg-meta { min-width: 0; }
.line1 { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.from { font-weight: 700; color: var(--text); }
.addr { font-size: 12px; color: var(--muted); }
.line2 { font-size: 13px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: block; }
.to-line { border: 0; background: none; padding: 0; cursor: pointer; text-align: left; max-width: 100%; }
.msg-right { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; padding-left: 8px; }
.msg-right .acts { display: inline-flex; align-items: center; }
.msg .open-only { display: none; }
.msg.open .open-only { display: block; }
.msg.open .msg-right .open-only { display: inline-flex; }
.msg.open .collapsed-only { display: none; }
.msg.is-draft .from::after { content: ""; }
.details { margin: 8px 0 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; background: var(--surface); box-shadow: var(--shadow); max-width: 560px; cursor: default; }
.details th { text-align: right; color: var(--muted); font-weight: 400; padding: 2px 8px 2px 0; vertical-align: top; white-space: nowrap; }
.details td { word-break: break-all; }
.msg-body { padding: 12px 0 0 56px; }
.body-host { min-height: 20px; }
.mail-frame { width: 100%; border: 0; display: block; height: 60px; background: #fff; border-radius: 6px; }
.plain { white-space: normal; word-wrap: break-word; overflow-wrap: anywhere; font-size: 14px; line-height: 1.6; }
.warn-bar, .img-bar { display: flex; align-items: center; gap: 10px; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 12px; }
.warn-bar { background: var(--danger-soft); color: var(--danger); }
.img-bar { background: var(--surface-2); color: var(--text-2); }
.img-bar span { flex: 1; }
.atts { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.atts-head { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 10px; }
.att-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.att-chip { display: grid; grid-template-columns: 44px 1fr 32px; align-items: center; gap: 8px; width: 240px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 6px 6px 6px; text-decoration: none; color: var(--text); background: var(--surface); }
.att-chip:hover { background: var(--surface-2); }
.att-thumb { width: 44px; height: 44px; border-radius: 6px; background: var(--surface-3); display: grid; place-items: center; overflow: hidden; color: var(--danger); }
.att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-info { min-width: 0; display: flex; flex-direction: column; }
.att-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { font-size: 11.5px; color: var(--muted); }
.att-dl { color: var(--muted); display: grid; place-items: center; }
.more-msgs { display: block; width: 100%; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); height: 26px; cursor: pointer; font-weight: 600; font-size: 12px; margin: -1px 0 0; }
.more-msgs::before { content: "⋯ "; }
.thread-foot { display: flex; gap: 12px; padding: 20px 24px 0 88px; flex-wrap: wrap; }
.thread-foot .btn { height: 38px; padding: 0 20px 0 16px; }

/* ---------- compose ---------- */
.compose-dock { position: fixed; right: 16px; bottom: 0; display: flex; flex-direction: row-reverse; align-items: flex-end; gap: 16px; z-index: 40; pointer-events: none; }
.composer { pointer-events: auto; width: 560px; height: min(560px, calc(100vh - 80px)); background: var(--surface); border-radius: 12px 12px 0 0; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.composer.min { height: 44px; width: 280px; }
.composer.min .cp-body, .composer.min .cp-foot, .composer.min .cp-fmt { display: none; }
.composer.max { position: fixed; inset: 5vh 8vw; width: auto; height: auto; border-radius: 12px; z-index: 60; }
body.compose-max::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 39; }
.composer.drop { outline: 3px dashed var(--accent); outline-offset: -6px; }
.cp-head { display: flex; align-items: center; gap: 2px; background: var(--surface-2); padding: 0 6px 0 16px; height: 44px; flex: none; cursor: default; }
.composer.min .cp-head { cursor: pointer; }
.cp-title { flex: 1; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-body { flex: 1; display: flex; flex-direction: column; overflow-y: auto; min-height: 0; padding: 0 16px; }
.cp-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); min-height: 40px; padding: 4px 0; position: relative; }
.cp-label { color: var(--muted); padding-right: 6px; }
.cp-row input, .cp-row select { border: 0; outline: none; background: transparent; flex: 1; min-width: 120px; height: 30px; }
.cp-from { cursor: pointer; }
.cp-subject { font-size: 14px; }
.chips { display: contents; }
.chip { display: inline-flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 1px 2px 1px 10px; font-size: 13px; max-width: 100%; }
.chip.bad { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.chip button { border: 0; background: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--muted); padding: 0; }
.chip button:hover { background: var(--hover); }
.chip button .ic { width: 14px; height: 14px; }
.cc-links { display: inline-flex; gap: 2px; margin-left: auto; }
.cc-links .link-btn { color: var(--text-2); font-size: 13px; }
.ac-list { position: absolute; top: 100%; left: 40px; z-index: 5; min-width: 280px; max-width: 100%; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 6px 0; }
.ac-list button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; border: 0; background: none; padding: 6px 16px; cursor: pointer; text-align: left; }
.ac-list button span { font-size: 12px; color: var(--muted); }
.ac-list button.on, .ac-list button:hover { background: var(--hover); }
.cp-editor { flex: 1; min-height: 160px; padding: 12px 0; outline: none; font: 14px/1.55 Arial, Helvetica, "PingFang SC", "Microsoft YaHei", sans-serif; overflow-wrap: anywhere; }
.cp-editor blockquote { margin: 0 0 0 .8ex; border-left: 1px solid var(--line-2); padding-left: 1ex; color: var(--text-2); }
.cp-editor img { max-width: 100%; }
.cp-editor .rm-sig { color: var(--text-2); }
.cp-atts { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; }
.cp-att { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 6px; padding: 4px 6px 4px 10px; font-size: 13px; }
.cp-att .n { flex: 1; font-weight: 600; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-att .s { color: var(--muted); }
.cp-att.up { opacity: .6; }
.cp-fmt { display: flex; gap: 2px; padding: 4px 12px; margin: 0 12px; border-radius: 8px; box-shadow: var(--shadow); background: var(--surface); flex: none; }
.cp-foot { display: flex; align-items: center; gap: 4px; padding: 10px 12px 12px 16px; flex: none; }
.send-btn { padding: 0 26px; }
.aa { font: 600 15px Georgia, serif; text-decoration: underline; }
.cp-status { color: var(--muted); font-size: 12px; padding-left: 8px; }

/* ---------- pages: settings & admin ---------- */
.page { overflow: hidden; }
.page-head { padding: 18px 28px 0; border-bottom: 1px solid var(--line); flex: none; }
.page-head h1 { font-size: 22px; font-weight: 500; margin: 0 0 14px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--text-2); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.page-body { overflow-y: auto; padding: 20px 28px 40px; flex: 1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; margin-bottom: 16px; max-width: 980px; }
.card.flush { padding: 0; overflow: hidden; }
.card h2 { font-size: 16px; font-weight: 600; margin: 0 0 16px; }
.card .field input, .card .field select, .card .field textarea { max-width: 520px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.card-head h2 { margin: 0; }
.card-head.bare { padding: 0 0 14px; max-width: 980px; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; max-width: 520px; }
.card.flush .row-actions, .row-actions.pad { padding: 12px 16px; max-width: none; }
.kv { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.kv span { color: var(--muted); min-width: 120px; }
.setting-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.setting-line:first-of-type { border-top: 0; padding-top: 0; }
.setting-line p { margin: 4px 0 0; font-size: 13px; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.pill { display: inline-block; font-size: 11.5px; font-weight: 600; border-radius: 10px; padding: 1px 8px; background: var(--surface-3); color: var(--text-2); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.info { background: var(--info-soft); color: var(--accent); }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.right { text-align: right; }
.tbl.audit td.detail { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell div { display: flex; flex-direction: column; }
.user-cell .muted { font-size: 12px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; max-width: 980px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.stat span { font-size: 12.5px; color: var(--muted); }
.stat b { font-size: 22px; font-weight: 600; }
.box-head { display: flex; align-items: center; gap: 12px; }
.box-head > .ic { color: var(--accent); }
.box-head div { display: flex; flex-direction: column; }
.box-head .muted { font-size: 12.5px; }
.sub-head { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 16px 0 8px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---------- menus, dialogs, toasts ---------- */
.menu { position: fixed; z-index: 100; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 8px 0; min-width: 220px; max-width: 360px; }
.menu button { display: flex; align-items: center; gap: 14px; width: 100%; border: 0; background: none; padding: 8px 18px; cursor: pointer; text-align: left; font-size: 14px; }
.menu button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu button:hover { background: var(--hover); }
.menu button .ic { color: var(--muted); width: 18px; height: 18px; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.modal-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; display: grid; place-items: center; padding: 16px; animation: fade .12s ease-out; }
.modal { background: var(--surface); border-radius: 24px; padding: 24px; width: 100%; max-width: 440px; box-shadow: var(--shadow-lg); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal.wide { max-width: 560px; }
.modal h2 { font-size: 20px; font-weight: 500; margin: 0 0 16px; }
.modal p { margin: 0 0 12px; color: var(--text-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 24px; bottom: 24px; z-index: 110; display: flex; align-items: center; gap: 8px; background: #1f1f1f; color: #f1f1f1; border-radius: 6px; padding: 6px 6px 6px 18px; min-height: 48px; max-width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); transform: translateY(140%); transition: transform .2s; font-size: 14px; }
:root[data-theme="dark"] .toast { background: #e6e8eb; color: #1f1f1f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #e6e8eb; color: #1f1f1f; } :root:not([data-theme="light"]) .toast .toast-act { color: #0b57d0; } :root:not([data-theme="light"]) .toast .icon-btn { color: #444; } }
.toast.show { transform: none; }
.toast.error { background: #8c1d18; color: #fff; }
.toast span { flex: 1; }
.toast-act { border: 0; background: none; color: #a8c7fa; font-weight: 700; cursor: pointer; padding: 8px 10px; border-radius: 4px; }
.toast .icon-btn { color: #ccc; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .row { grid-template-columns: 40px 32px minmax(100px, 160px) 1fr auto 72px; }
}
@media (max-width: 860px) {
  .layout, .layout.nav-mini { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "banner" "main"; }
  .brand { width: auto; }
  .brand-name { display: none; }
  .sidenav { position: fixed; top: 0; bottom: 0; left: 0; width: 280px; background: var(--bg); z-index: 50; transform: translateX(-100%); transition: transform .2s; padding-top: 16px; }
  .layout.nav-open .sidenav { transform: none; box-shadow: var(--shadow-lg); }
  .layout.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 45; }
  .layout.nav-mini .sidenav .compose-btn span, .layout.nav-mini .sidenav .nav-item .label, .layout.nav-mini .nav-head { display: initial; }
  .layout.nav-mini .nav-item, .layout.nav-mini .compose-btn { width: auto; justify-content: flex-start; margin-left: 0; padding: 0 12px 0 24px; border-radius: 0 16px 16px 0; }
  .layout.nav-mini .compose-btn { margin-left: 8px; padding: 0 24px 0 18px; border-radius: 16px; }
  .layout.nav-mini .nav-item .count { position: static; background: none; color: inherit; }
  .main { padding: 0; }
  .panel { border-radius: 0; }
  .top-banner { margin: 0 8px 8px; }
  .search { height: 44px; }
  .topbar { padding-right: 8px; }
  .top-actions { padding-left: 4px; }
  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: 20px; width: 56px; height: 56px; border-radius: 16px; border: 0; background: var(--compose); color: var(--text); box-shadow: var(--shadow); z-index: 30; cursor: pointer; }
  .fab .ic { width: 24px; height: 24px; }
  .hide-sm { display: none !important; }
  .row { grid-template-columns: 36px 1fr auto; grid-template-rows: auto auto; height: auto; padding: 10px 12px 10px 4px; row-gap: 2px; }
  .row .star { display: none; }
  .row .cb { grid-row: 1 / span 2; width: 36px; }
  .row .who { grid-column: 2; }
  .row .when { grid-column: 3; grid-row: 1; }
  .row .what { grid-column: 2 / span 2; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .row .att { display: none; }
  .row:hover .hover-acts { display: none; }
  .row:hover .when { visibility: visible; }
  .thread-head { padding: 8px 16px 12px; }
  .msgs { padding: 0 8px; }
  .msg-head { grid-template-columns: 48px 1fr auto; }
  .msg-body { padding-left: 0; }
  .thread-foot { padding: 16px 12px 0; }
  .compose-dock { right: 0; left: 0; }
  .composer, .composer.max { position: fixed; inset: 0; width: auto; height: auto; border-radius: 0; z-index: 60; }
  .composer.min { inset: auto 0 0 0; height: 44px; }
  .page-head { padding: 14px 16px 0; }
  .page-body { padding: 16px 12px 40px; }
  .card { padding: 16px; }
  .two { grid-template-columns: 1fr; }
  .att-chip { width: 100%; }
  .toast { left: 16px; right: 16px; bottom: 16px; }
}
@media (max-width: 480px) {
  .auth-card { padding: 28px 20px 22px; border-radius: 20px; border: 0; }
  .auth-page { padding: 12px; justify-content: flex-start; padding-top: 6vh; }
  .top-actions .icon-btn:not(.avatar-btn) { width: 36px; }
}
@media print {
  .topbar, .sidenav, .toolbar, .thread-foot, .compose-dock { display: none !important; }
}
