:root {
  color-scheme: dark;
  font: 15px/1.5 system-ui, "Microsoft YaHei", sans-serif;
  --bg: #151b27;
  --panel: #1d2636;
  --raised: #263246;
  --line: #3b4860;
  --text: #edf3ff;
  --muted: #aab8cf;
  --accent: #87b7ff;
  --blue: #285d9e;
  --red: #ffb2ad;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; color: inherit; }
button, input:not([type="checkbox"]), textarea, select {
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg); padding: .45rem .7rem;
}
button { cursor: pointer; background: var(--raised); white-space: nowrap; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .6; cursor: wait; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="checkbox"] { accent-color: #6ca5f1; }
textarea { resize: vertical; }
.primary { background: var(--blue); border-color: #558ac8; }
.danger { color: var(--red); border-color: #925657; }
.active, .selected { background: #283f5c; }
.muted, .empty { color: var(--muted); }
.small, small { font-size: .82rem; }
.error { color: var(--red); }
.error:empty { display: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.35rem; overflow-wrap: anywhere; }
h2 { font-size: 1.03rem; overflow-wrap: anywhere; }
h3 { font-size: 1.12rem; overflow-wrap: anywhere; }
.eyebrow { color: var(--accent); font-size: .78rem; letter-spacing: .09em; }
.startup, .empty { padding: 1.15rem; }
.topbar, .toolbar, .panel-head, .selection, .top-nav, .row-actions, .address-line, .filters, .dialog-actions {
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
}
.topbar { background: var(--panel); border-bottom: 1px solid var(--line); padding: .7rem 1.3rem; gap: 1rem; }
.brand { margin-right: .25rem; }
.top-nav { flex: 1; }
.workspace { max-width: 1900px; margin: auto; padding: 1rem; }
.toolbar { justify-content: space-between; margin-bottom: 1rem; }
.search { display: flex; align-items: center; gap: .6rem; flex: 0 1 30rem; }
.search input { min-width: 0; flex: 1; }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; }
.panel-head { padding: .8rem; border-bottom: 1px solid var(--line); }
.panel-head h2 { flex: 1 0 auto; max-width: 100%; }
.management { display: grid; grid-template-columns: minmax(180px, 235px) minmax(0, 1fr); gap: .85rem; align-items: start; }
.tree { padding-bottom: .5rem; }
.tree-item { width: calc(100% - 1rem); margin: .25rem .5rem 0; text-align: left; border-color: transparent; white-space: normal; overflow-wrap: anywhere; }
.tree-item.child { padding-inline-start: 1.55rem; }
.group-grid { display: flex; flex-wrap: wrap; gap: .7rem; padding: .85rem; }
.group-card { white-space: normal; overflow-wrap: anywhere; text-align: start; padding: .7rem 1rem; max-width: 100%; }
.choose > .panel { margin-bottom: .8rem; }
.selection { min-height: 2.4rem; padding: .3rem .8rem; font-size: .86rem; }
.account-row { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .6rem; padding: .65rem .8rem; border-top: 1px solid var(--line); }
.address-line { flex-wrap: nowrap; }
.address { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.address { padding: 0; border-color: transparent; background: transparent; text-align: left; }
.address:hover { color: var(--accent); }
.copy-address { color: var(--accent); padding: .13rem .35rem; font-size: .79rem; }
.account-number { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .8rem; }
.note { display: block; margin: .2rem 0 0 2.2rem; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.row-actions { justify-content: flex-end; }
.badge { display: inline-block; white-space: nowrap; font-size: .79rem; padding: .12rem .42rem; border-radius: 4px; }
.s0 { color: #d9e0ea; background: #434d5e; }
.s1 { color: #ffe196; background: #53441e; }
.s2 { color: #a5efbc; background: #214e37; }
.more { position: relative; }
.more summary { cursor: pointer; list-style: none; padding: .12rem .45rem; border: 1px solid var(--line); border-radius: 5px; }
.more summary::-webkit-details-marker { display: none; }
.menu { position: absolute; inset-inline-end: 0; z-index: 2; display: grid; gap: .25rem; padding: .4rem; background: var(--raised); border: 1px solid var(--line); border-radius: 6px; }
.work-grid { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(0, 1.75fr); gap: .7rem; align-items: start; }
.mail-layout { display: grid; grid-template-columns: minmax(175px, .8fr) minmax(0, 1.2fr); gap: .7rem; align-items: start; }
.work-grid > .panel, .mail-layout > .panel { min-height: 19rem; }
.work-grid .account-row { grid-template-columns: auto minmax(0, 1fr); }
.work-grid .row-actions { grid-column: 2; justify-content: flex-start; }
.filters { padding: .55rem .65rem; }
.folder-status { padding: .3rem .65rem; font-size: .8rem; }
.mail-item { display: block; width: 100%; border: 0; border-top: 1px solid var(--line); border-radius: 0; text-align: start; padding: .65rem; white-space: normal; background: transparent; }
.mail-item.active, .mail-item:hover { background: var(--raised); }
.mail-item span, .mail-item small { display: block; color: var(--muted); }
.mail-item strong, .mail-item span { overflow-wrap: anywhere; }
.detail-inner { padding: .9rem; overflow-wrap: anywhere; }
.detail-inner > .muted { margin: .3rem 0; }
.mail-body { margin-top: .85rem; }
.mail-body.plain { white-space: pre-wrap; }
.mail-body pre { white-space: pre-wrap; }
.mail-body table { display: block; max-width: 100%; overflow-x: auto; }
.mail-body a { color: var(--accent); }
.mail-body .email-button { display: inline-block; padding: .45rem .7rem; border-radius: 5px; background: var(--blue); color: var(--text); text-decoration: none; }
.verification { display: flex; align-items: center; gap: .45rem; margin: .5rem 0; }
.link-list { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .65rem; }
.link-list summary { cursor: pointer; }
.link-list > div { display: flex; gap: .4rem; justify-content: space-between; align-items: center; margin-top: .45rem; }
.login { min-height: 90vh; display: grid; place-items: center; padding: 1rem; }
.login-card, dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem; }
.login-card { display: grid; gap: .8rem; width: min(100%, 370px); }
.login-card label, dialog label { display: grid; gap: .35rem; }
dialog { width: min(calc(100% - 2rem), 550px); }
dialog::backdrop { background: #080d18bb; }
dialog form { display: grid; gap: .85rem; }
.dialog-actions { justify-content: end; }
#notice { position: fixed; z-index: 5; inset: auto 1rem 1rem auto; max-width: calc(100% - 2rem); background: #224833; border: 1px solid #639a76; border-radius: 7px; padding: .6rem .9rem; }
#notice.bad { background: #563138; border-color: #b87578; }
.clipboard { position: fixed; inset: auto auto 0 -1000px; }
@media (max-width: 1000px) {
  .work-grid { grid-template-columns: minmax(245px, .75fr) minmax(0, 1.25fr); }
  .mail-layout { grid-template-columns: 1fr; }
  .mail-layout > .panel { min-height: 0; }
}
@media (max-width: 650px) {
  .management, .work-grid { grid-template-columns: 1fr; }
  .topbar, .workspace { padding: .65rem; }
  .search { flex-basis: 100%; }
  .account-row { grid-template-columns: auto minmax(0, 1fr); }
  .row-actions { grid-column: 2; justify-content: flex-start; }
}
