:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #17263d;
  background: #f4f7fb;
  --muted: #52647c;
  --line: #e0e7f0;
  --blue: #1854c7;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
body, p, h1, h2, h3 { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .58; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #4e8af7; outline-offset: 2px; }
svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 223px minmax(0, 1fr); }
.sidebar { color: #c8d6ee; background: #102340; display: flex; flex-direction: column; padding: 24px 16px 18px; min-width: 0; }
.brand, .sidebar-foot { display: flex; align-items: center; gap: 11px; }
.brand { padding: 1px 5px 0; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: white; background: #2462de; flex: none; }
.brand-mark svg { width: 22px; height: 22px; }
.brand strong, .sidebar-foot strong { color: #f5f8ff; font-size: 14px; }
.brand small, .sidebar-foot small { display: block; margin-top: 4px; font-size: 10px; letter-spacing: .09em; }
.nav-caption { margin: 43px 10px 11px; font-size: 11px; color: #a6b8d4; letter-spacing: .1em; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav button { display: flex; align-items: center; gap: 10px; color: inherit; padding: 11px; text-align: left; border: 1px solid transparent; background: transparent; border-radius: 8px; font-size: 14px; }
.sidebar nav button:hover, .sidebar nav button[aria-current="page"] { background: #203c66; color: #f5f8ff; border-color: #31527f; }
.sidebar-foot { margin-top: auto; padding: 16px 2px 0; border-top: 1px solid #304360; }
.sidebar-avatar { width: 32px; height: 32px; display: grid; place-items: center; background: #294772; border-radius: 50%; color: #eff5ff; font-size: 13px; flex: none; }
.sidebar-foot button { margin-left: auto; }
.icon-button { border: 0; background: transparent; color: inherit; display: grid; place-items: center; padding: 7px; border-radius: 6px; }
.icon-button:hover { background: #829fcb29; }
.topbar { background: #fff; height: 60px; padding: 0 clamp(20px, 3vw, 40px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; }
.topbar strong { color: #24364f; }
.crumb-slash { margin: 0 8px; color: #718096; }
.provider { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.provider span { background: #2b64d1; width: 7px; height: 7px; border-radius: 50%; }
.content { max-width: 1420px; margin: 0 auto; padding: 32px clamp(20px, 3vw, 40px) 20px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.eyebrow { color: var(--blue); font-size: 11px; letter-spacing: .12em; font-weight: 700; margin-bottom: 8px; }
h1 { font-size: clamp(27px, 3vw, 35px); letter-spacing: -.035em; line-height: 1.22; }
h2 { font-size: 16px; }
h3 { font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.55; }
.page-header .muted, .login-card .muted { margin-top: 8px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 8px; min-height: 38px; padding: 8px 13px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.button svg { width: 16px; height: 16px; }
.primary { color: white; background: var(--blue); }
.primary:hover:enabled { background: #1645a3; }
.secondary { color: #253a55; background: #fff; border-color: #d8e2ef; }
.secondary:hover:enabled { background: #eff5ff; border-color: #b8ccee; }
.danger { color: #fff; background: #ad2d3c; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.metric { min-height: 92px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; align-items: center; gap: 14px; }
.metric-icon, .empty-icon { width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.metric .blue, .empty-icon { background: #e9f1ff; color: var(--blue); }
.metric .green { background: #e8f7ef; color: #176c44; }
.metric .amber { background: #fff3d9; color: #87530c; }
.metric div span { color: var(--muted); display: block; font-size: 12px; }
.metric strong { display: block; margin-top: 3px; font-size: 25px; font-variant-numeric: tabular-nums; }
.panel { border: 1px solid var(--line); background: #fff; border-radius: 12px; overflow: hidden; }
.panel-header { padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.filters { display: flex; gap: 8px; }
select, .search, .login-card input { background: #fff; color: #263a54; border: 1px solid #d8e2ef; border-radius: 7px; padding: 8px 9px; font-size: 13px; min-width: 0; }
.search { display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.search svg { width: 15px; height: 15px; color: var(--muted); }
.search input { min-width: 0; width: 137px; padding: 7px 1px; border: 0; background: transparent; }
#mailbox-picker { max-width: min(52vw, 420px); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; min-width: 590px; }
th { background: #f4f7fb; color: #435674; font-size: 12px; font-weight: 600; }
th, td { padding: 12px 18px; border-top: 1px solid var(--line); vertical-align: middle; }
td:first-child { overflow-wrap: anywhere; }
.account-email { font-weight: 650; }
.account-secondary { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 20px; padding: 3px 8px; white-space: nowrap; font-size: 11px; font-weight: 600; }
.badge::before { content: ''; width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.badge.connected { color: #176c44; background: #e8f7ef; }
.badge.reconnect { color: #82520d; background: #fff3d9; }
.badge.error { color: #a42e39; background: #fff0f2; }
.row-actions { display: flex; gap: 10px; }
.text-button { border: 0; background: transparent; padding: 4px 0; color: var(--blue); font-size: 12px; white-space: nowrap; }
.text-button:hover { text-decoration: underline; }
.text-button.remove { color: var(--muted); }
.empty { display: grid; justify-items: center; gap: 7px; padding: 38px 20px; text-align: center; border-top: 1px solid var(--line); }
.empty-icon { margin-bottom: 4px; }
.panel-footer { border-top: 1px solid var(--line); padding: 12px 18px; color: var(--muted); font-size: 12px; }
.workspace-footer { display: flex; justify-content: space-between; gap: 8px; margin-top: 22px; color: var(--muted); font-size: 11px; }
.notice { border: 1px solid #b8cdef; background: #edf4ff; color: #204681; border-radius: 8px; padding: 11px 13px; margin-bottom: 16px; font-size: 13px; }
.notice.setup { display: flex; align-items: center; gap: 7px; }
.notice.error, .form-error { color: #a42e39; }
.notice.error { border-color: #edc5cd; background: #fff0f2; }
.inbox-state:not(:empty) { border-top: 1px solid var(--line); padding: 18px; }
.messages { list-style: none; padding: 0; margin: 0; }
.message-row { display: grid; width: 100%; grid-template-columns: minmax(80px, 1fr) minmax(0, 2.4fr) auto; gap: 14px; align-items: center; padding: 13px 18px; text-align: left; background: #fff; color: inherit; border: 0; border-top: 1px solid var(--line); font-size: 13px; }
.message-row:hover { background: #f2f6fe; }
.message-row.unread .message-subject { font-weight: 750; color: #164ba5; }
.message-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-row .message-content { display: grid; gap: 3px; }
.message-date { color: var(--muted); font-size: 11px; }
dialog { border: 1px solid var(--line); border-radius: 12px; padding: 20px; color: #17263d; max-height: 85vh; width: min(680px, calc(100vw - 32px)); }
dialog::backdrop { background: #101f39a8; }
#disconnect-dialog { width: min(430px, calc(100vw - 32px)); }
.dialog-header { display: flex; justify-content: space-between; gap: 12px; overflow-wrap: anywhere; }
.dialog-header h2 { font-size: 20px; }
.dialog-meta { margin: 10px 0; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.message-body { border-top: 1px solid var(--line); padding-top: 14px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: 14px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at top left, #dce9ff, transparent 68%), #f4f7fb; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px; box-shadow: 0 18px 65px #233e6c16; width: min(100%, 404px); }
.login-card .brand-mark { margin-bottom: 20px; }
.login-card label { display: block; font-weight: 650; font-size: 13px; margin: 25px 0 7px; }
.login-card input, .login-card .button { width: 100%; min-height: 42px; }
.login-card .button { margin-top: 12px; }
.form-error:not(:empty) { font-size: 13px; margin-top: 12px; }
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { padding: 11px 14px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
  .sidebar nav { order: 3; display: flex; width: 100%; }
  .nav-caption { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .sidebar-foot > span { display: none; }
  .topbar { height: 45px; }
  .content { padding-top: 20px; }
}
@media (max-width: 490px) {
  .page-header { flex-wrap: wrap; align-items: flex-start; }
  .metrics { gap: 6px; }
  .metric { padding: 8px; flex-direction: column; gap: 6px; align-items: flex-start; }
  .metric-icon { width: 28px; height: 28px; }
  .metric-icon svg { width: 15px; height: 15px; }
  .panel-header { align-items: flex-start; flex-wrap: wrap; padding: 12px; }
  .filters { flex-wrap: wrap; }
  .message-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
  .message-content { grid-column: 1 / -1; grid-row: 2; }
}
