:root {
  --bg: #f4f7f8;
  --panel: #ffffff;
  --panel-2: #edf4f5;
  --text: #17212b;
  --muted: #64717d;
  --border: #d8e2e5;
  --primary: #0f766e;
  --primary-2: #0b5f59;
  --primary-soft: #e3f5f2;
  --success: #12805c;
  --warning: #b7791f;
  --danger: #c2413a;
  --shadow: 0 18px 46px rgba(23, 33, 43, .09);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button, input, textarea, select {
  font: inherit;
  letter-spacing: 0;
}

button, select { cursor: pointer; }
input, textarea, select {
  border: 1px solid var(--border);
  background: #fbfdfd;
  color: var(--text);
  border-radius: 8px;
  padding: 9px 11px;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: #5bb8ae;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .14);
}
textarea { resize: vertical; min-height: 120px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }
.feature-hidden { display: none !important; }
.muted { color: var(--muted); }

.auth-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}
/* ── 左侧介绍区 ── */
.auth-intro {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 56px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 12% 82%, rgba(15, 118, 110, .28), transparent 52%),
    radial-gradient(ellipse at 88% 18%, rgba(79, 70, 165, .18), transparent 48%),
    linear-gradient(160deg, #0b5f59 0%, #142738 48%, #0f766e 100%);
  color: #fff;
}
.auth-intro::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}
.auth-intro::after {
  content: "";
  position: absolute;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  left: -120px;
  bottom: -120px;
  background: radial-gradient(circle, rgba(15, 118, 110, .35), transparent 60%);
  pointer-events: none;
}
.auth-intro-inner {
  position: relative;
  z-index: 1;
  max-width: 520px;
}
.auth-intro-brand {
  margin-bottom: 40px;
}
.brand-mark.large {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  font-size: 24px;
  background: rgba(255,255,255,.14);
  border: 2px solid rgba(255,255,255,.22);
  box-shadow: 0 16px 40px rgba(0,0,0,.20);
  margin-bottom: 20px;
}
.auth-intro-brand h1 {
  font-size: 32px;
  line-height: 1.12;
  margin: 0;
  color: #fff;
  letter-spacing: -.02em;
}
.auth-intro-tagline {
  margin: 10px 0 0;
  font-size: 16px;
  color: rgba(255,255,255,.68);
  line-height: 1.45;
}
.auth-intro-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 22px;
}
.auth-intro-features li {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.intro-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.16);
  padding: 0;
}
.intro-icon svg {
  width: 22px;
  height: 22px;
  fill: rgba(255,255,255,.82);
}
.auth-intro-features li strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
  color: #fff;
}
.auth-intro-features li span {
  display: block;
  font-size: 13px;
  color: rgba(255,255,255,.56);
  line-height: 1.4;
}
.auth-intro-footer {
  margin-top: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255,255,255,.38);
}
/* ── 右侧登录区 ── */
.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  position: relative;
  background: var(--bg);
}
.auth-form-side::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(23,33,43,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23,33,43,.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.40), transparent 65%);
  pointer-events: none;
}
.auth-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(216, 226, 229, .92);
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 24px 60px rgba(23, 33, 43, .14);
  backdrop-filter: blur(20px);
}
.auth-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border-top: 3px solid rgba(15, 118, 110, .68);
  pointer-events: none;
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.brand-lockup h1 { margin: 0; font-size: 24px; line-height: 1.1; }
.brand-lockup p { margin: 4px 0 0; color: var(--muted); }
.auth-panel .brand-lockup {
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 26px;
}
.auth-panel .brand-lockup h1 {
  font-size: 25px;
  line-height: 1.08;
  color: #14232b;
}
.auth-panel .brand-lockup p {
  margin-top: 7px;
  color: #6b7a84;
  font-weight: 500;
}
.brand-lockup.compact { margin-bottom: 26px; }
.brand-lockup.compact strong { display: block; font-size: 16px; }
.brand-lockup.compact small { color: var(--muted); }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0f766e, #23304a);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(15, 118, 110, .22);
}
.auth-panel .brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 18px;
  box-shadow: 0 14px 30px rgba(15, 118, 110, .24);
}
.field-stack { display: grid; gap: 12px; margin-bottom: 16px; }
.auth-panel .field-stack {
  gap: 14px;
  margin-bottom: 18px;
}
.field-stack label, .field {
  display: grid;
  gap: 7px;
  color: #33424d;
  font-weight: 600;
}
.auth-panel .field-stack label {
  gap: 8px;
  color: #273842;
}
.auth-panel .field-stack input {
  min-height: 44px;
  width: 100%;
  border-color: #cfdbde;
  background: #fafdfe;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
}
.auth-panel .field-stack input:hover {
  border-color: #b9cbcf;
}
.auth-panel .field-stack input:focus {
  background: #fff;
  border-color: #44a59b;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .14), 0 8px 18px rgba(23, 33, 43, .06);
}
.field input, .field textarea { width: 100%; font-weight: 400; }
.form-error { color: var(--danger); min-height: 20px; margin: 10px 0 0; }
.auth-panel .form-error {
  margin-top: 12px;
  font-weight: 600;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--border);
  background: rgba(251,253,253,.9);
  backdrop-filter: blur(18px);
  padding: 18px;
  display: flex;
  flex-direction: column;
}
.nav-list { display: grid; gap: 6px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #52616e;
  padding: 10px 11px;
  text-align: left;
  text-decoration: none;
  font: inherit;
}
.nav-item:hover { background: #edf4f5; color: var(--text); }
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-2);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--primary);
}
.bottom-action { margin-top: auto; }
.workspace {
  min-width: 0;
  padding: 22px;
  height: 100vh;
  overflow: auto;
}
.workspace.mailboxes-workspace {
  overflow: hidden;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.topbar h1 { margin: 0; font-size: 27px; line-height: 1.15; }
.topbar p { margin: 5px 0 0; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.user-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fbfdfd;
  color: #33424d;
  box-shadow: 0 3px 12px rgba(23, 33, 43, .05);
}

.tab-panel { display: none; }
.tab-panel.active { display: grid; gap: 16px; }
#tab-mailboxes.active {
  height: calc(100vh - 118px);
  min-height: 0;
  overflow: hidden;
}
#tab-mailboxes.active .mailboxes-panel {
  height: 100%;
  min-height: 0;
}
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid.tight { gap: 10px; margin-top: 12px; }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(128px, 1fr));
  gap: 14px;
}
.metric-card {
  background: linear-gradient(180deg, #ffffff, #fbfdfd);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: 0 8px 24px rgba(23,33,43,.05);
  cursor: pointer;
}
.metric-card:hover { border-color: #8ccfc8; box-shadow: 0 12px 28px rgba(15,118,110,.10); }
.metric-card strong { display: block; font-size: 26px; line-height: 1; margin-bottom: 9px; }
.metric-card span { color: var(--muted); }
.metric-card small { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; }
.compact-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  margin-bottom: 12px;
}
.reuse-platform-card { cursor: pointer; }
.reuse-platform-card.active {
  border-color: #8ccfc8;
  background: #edf8f6;
  box-shadow: inset 3px 0 0 var(--primary);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(23,33,43,.05);
  padding: 16px;
  min-width: 0;
}
.primary-admin-only {
  border-left: 3px solid var(--primary);
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.panel-head h2 { margin: 0; font-size: 17px; line-height: 1.25; }
.panel-head p { margin: 3px 0 0; }
.panel-head h3 { margin: 0; font-size: 15px; line-height: 1.25; }
.compact-head { align-items: center; margin-bottom: 10px; }

.button, .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
  color: #33424d;
  min-height: 38px;
  padding: 8px 12px;
  font-weight: 600;
  text-decoration: none;
}
.button:hover, .icon-button:hover { background: #f1f7f7; text-decoration: none; border-color: #bdd5d8; }
.button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-2); }
.button.secondary { background: var(--primary-soft); border-color: #9fd8d1; color: var(--primary-2); }
.button.ghost { background: transparent; }
.button.danger { border-color: #f1b7b3; color: var(--danger); background: #fff6f5; }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button.wide { width: 100%; }
.auth-panel .button {
  min-height: 44px;
}
.auth-panel .button.primary {
  box-shadow: 0 12px 24px rgba(15, 118, 110, .22);
}
.auth-panel .button.primary:hover {
  box-shadow: 0 14px 28px rgba(15, 118, 110, .26);
}
.auth-panel .button.ghost {
  border-color: transparent;
  color: #51616c;
}
.auth-panel .button.ghost:hover {
  background: #eef6f5;
  border-color: #d8e8e7;
  color: var(--primary-2);
}
.auth-divider {
  display: flex;
  align-items: center;
  margin: 16px 0 0;
  gap: 0;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #d5e0e3;
}
.auth-divider span {
  padding: 0 12px;
  color: #8a9ca6;
  font-size: 13px;
  font-weight: 500;
}
.auth-panel .button.register-link {
  background: rgba(15, 118, 110, .08);
  border: 1px dashed rgba(15, 118, 110, .35);
  color: var(--primary-2);
  font-weight: 600;
  margin-top: 12px;
}
.auth-panel .button.register-link:hover {
  background: rgba(15, 118, 110, .15);
  border: 1px solid rgba(15, 118, 110, .45);
}
.auth-panel .button + .button { margin-top: 10px; }
.icon-button {
  width: 38px;
  padding: 0;
}
.button-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.button-row.end { justify-content: flex-end; }
.icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  display: inline-block;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.gpt-dashboard {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
}
.mini-metric {
  background: linear-gradient(180deg, #ffffff, #fbfdfd);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  box-shadow: 0 8px 24px rgba(23,33,43,.05);
}
.mini-metric strong {
  display: block;
  font-size: 24px;
  line-height: 1;
  margin-bottom: 7px;
}
.mini-metric span { color: var(--muted); }
.gpt-native-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fbfdfd;
  box-shadow: 0 8px 24px rgba(23,33,43,.05);
  overflow-x: auto;
}
.gpt-native-tab {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #52616e;
  padding: 7px 12px;
  white-space: nowrap;
  font-weight: 700;
}
.gpt-native-tab:hover {
  background: #f1f7f7;
  color: var(--text);
}
.gpt-native-tab.active {
  border-color: #9fd8d1;
  background: var(--primary-soft);
  color: var(--primary-2);
}
.gpt-native-panel {
  min-width: 0;
}
.gpt-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.wide-field {
  grid-column: span 2;
}
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 58px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
}
.checkbox-field input {
  width: auto;
}
.progress-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f5faf9;
  padding: 12px;
  margin-bottom: 12px;
}
.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #33424d;
  font-weight: 700;
  margin-bottom: 8px;
}
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: #d7e8e8;
  overflow: hidden;
}
.progress-track > div {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width .2s ease;
}
.terminal {
  margin: 10px 0 0;
  min-height: 170px;
  max-height: 260px;
  overflow: auto;
  border-radius: 8px;
  background: #17212b;
  color: #dce7e8;
  padding: 12px;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.mini-terminal {
  min-height: 150px;
}
.converter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}
.converter-textarea {
  min-height: 360px;
  margin-bottom: 0;
}
.gpt-cpa-table {
  max-height: 520px;
  overflow: auto;
}
.sub-panel {
  border: 1px dashed #9fd8d1;
  background: #f5faf9;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}
.import-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.import-textarea {
  width: 100%;
  min-height: 140px;
  margin-bottom: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.gpt-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}
.compact-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}
.compact-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fbfdfd;
}
.compact-item.active {
  border-color: #8ccfc8;
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}
.compact-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compact-item small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compact-empty {
  padding: 18px;
  min-height: 0;
}
.block-text {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}
.danger-text {
  color: var(--danger) !important;
}
.export-detail {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  border: 1px solid #9fd8d1;
  border-radius: 9px;
  background: #f5faf9;
  padding: 12px;
}
.export-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.export-detail-head strong,
.export-account-row strong {
  display: block;
}
.export-detail-head small,
.export-account-row small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}
.export-account-list {
  display: grid;
  gap: 7px;
  max-height: 220px;
  overflow: auto;
}
.export-account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
}
.event-item {
  display: block;
}
.event-item summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  list-style: none;
}
.event-item summary::-webkit-details-marker {
  display: none;
}
.event-detail {
  margin: 9px 0 0;
  max-height: 180px;
  overflow: auto;
  border-radius: 8px;
  background: #17212b;
  color: #dce7e8;
  padding: 10px;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(320px, 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfd;
  padding: 0 10px;
}
.search-box input {
  border: 0;
  box-shadow: none;
  padding-left: 0;
  flex: 1;
  min-width: 0;
}
.mini-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  white-space: nowrap;
}
.mini-field input {
  width: 76px;
  padding: 8px 9px;
}
.delivery-test-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 13px;
  margin: 12px 0;
  background: #f8fbfb;
}
.delivery-test-head,
.delivery-batch-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.delivery-test-panel h3 { margin: 0; font-size: 15px; }
.delivery-controls { display: flex; flex: 1 1 480px; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.delivery-controls input { flex: 1 1 260px; min-width: 220px; }
.delivery-controls select { width: 140px; }
.delivery-result {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  white-space: pre-wrap;
}
.delivery-result.success strong { color: #047857; }
.delivery-result.error strong, .delivery-result.error { color: #b91c1c; }
.inline-guide {
  margin: 8px 0 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 9px;
  color: #334155;
  white-space: pre-wrap;
}
.delivery-batch {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.delivery-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.delivery-results { max-height: 260px; overflow: auto; }
.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.account-select, #select-page-accounts {
  width: 16px;
  height: 16px;
  padding: 0;
}
.user-role-select {
  min-width: 110px;
  padding: 7px 9px;
}
.mini-table th, .mini-table td {
  padding: 8px 9px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 9px;
}
.accounts-panel {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 122px);
  min-height: 560px;
  overflow: hidden;
}
.accounts-panel .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
}
.mailboxes-panel .panel-head {
  flex: 0 0 auto;
  align-items: center;
}
.mailboxes-panel .button-row {
  flex-wrap: nowrap;
  gap: 8px;
}
.mailboxes-panel .toolbar {
  display: grid;
  grid-template-columns:
    minmax(220px, 1.35fr)
    minmax(120px, .62fr)
    78px
    104px
    104px
    repeat(7, max-content);
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.mailboxes-panel .toolbar .search-box {
  min-width: 0;
  width: 100%;
}
.mailboxes-panel .toolbar select,
.mailboxes-panel .toolbar input {
  min-height: 34px;
  padding-top: 6px;
  padding-bottom: 6px;
}
.mailboxes-panel .toolbar .mini-field {
  justify-content: flex-start;
}
.mailboxes-panel .toolbar .mini-field input {
  width: 70px;
}
.mailboxes-panel .toolbar .button,
.mailboxes-panel .panel-head .button {
  min-height: 34px;
  padding: 6px 10px;
  gap: 6px;
  white-space: nowrap;
  line-height: 1;
}
.mailboxes-panel .panel-head {
  margin-bottom: 12px;
}
.mailboxes-panel .toolbar {
  margin-bottom: 10px;
}
.mailboxes-panel .table-wrap {
  overflow: auto;
  min-height: 0;
}
.mailboxes-panel table {
  min-width: 1180px;
}
.reuse-panel table { min-width: 1080px; }
.mailboxes-panel th,
.mailboxes-panel td {
  padding-top: 9px;
  padding-bottom: 9px;
}
.invite-panel {
  display: flex;
  flex-direction: column;
  max-height: min(620px, calc(100vh - 180px));
  min-height: 360px;
  overflow: hidden;
}
.invite-panel .panel-head {
  flex: 0 0 auto;
  align-items: flex-start;
  gap: 12px;
}
.invite-panel .button-row {
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.invite-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 94px auto;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
  margin-bottom: 10px;
}
.invite-toolbar .search-box {
  width: 100%;
  min-width: 0;
}
.invite-toolbar select {
  min-height: 36px;
}
.invite-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.invite-table-wrap table {
  min-width: 820px;
}
.admin-users-panel {
  display: flex;
  flex-direction: column;
  min-height: 520px;
  max-height: min(680px, calc(100vh - 210px));
  overflow: hidden;
}
.admin-users-panel .panel-head,
.admin-users-panel .toolbar,
.admin-users-toolbar {
  flex: 0 0 auto;
}
.admin-users-panel .toolbar {
  margin-bottom: 10px;
}
.admin-users-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.compact-search {
  min-width: 260px;
}
.admin-users-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 94px auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.admin-users-toolbar .search-box {
  width: 100%;
  min-width: 0;
}
.admin-users-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.admin-users-table-wrap table {
  min-width: 1260px;
}
.admin-invite-panel {
  max-height: min(420px, calc(100vh - 150px));
  min-height: 300px;
}
.pager.compact {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}
.pager.compact .button {
  min-height: 34px;
  padding: 6px 10px;
}
.selection-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #f2f7f7;
  color: #33424d;
}
.link-button {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}
.link-button:hover { text-decoration: underline; }
.selection-dot { color: var(--muted); }

.status-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
th {
  background: #f2f7f7;
  color: #667782;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}
tbody tr:hover { background: #f5faf9; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
.email-cell strong { display: block; }
.email-cell small { color: var(--muted); }
.reason-cell { max-width: 440px; color: #52616e; word-break: break-word; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef4f5;
  color: #52616e;
  font-weight: 700;
  font-size: 12px;
}
.badge.safe { background: #e5f8f1; color: #0a6f52; }
.badge.free { background: #e3f5f2; color: #0b5f59; }
.badge.plus, .badge.pro, .badge.team, .badge.plan { background: #ecebfd; color: #4f46a5; }
.badge.error, .badge.invalid { background: #fff0ee; color: #ad342f; }
.badge.new { background: #eef4f5; color: #64717d; }
.badge.review { background: #fff7e5; color: #a26010; }
.badge.used { background: #eef4f5; color: #33424d; }
.badge.code-healthy { background: #e5f8f1; color: #0a6f52; }
.badge.code-suspect { background: #fff7e5; color: #a26010; }
.badge.code-no_code, .badge.code-blocked, .badge.code-unhealthy { background: #fff0ee; color: #ad342f; }
.badge.code-unknown { background: #ecebfd; color: #4f46a5; }
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 12px;
  flex: 0 0 auto;
}

.progress-block { display: grid; gap: 9px; margin-bottom: 12px; }
.progress-line { display: flex; justify-content: space-between; color: var(--muted); }
.progress {
  height: 9px;
  background: #e5ecee;
  border-radius: 999px;
  overflow: hidden;
}
.progress div {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width .2s ease;
}
.log-box {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #17212b;
  color: #cbdadd;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  min-height: 130px;
  max-height: 260px;
}
.log-box.compact { min-height: 120px; max-height: 210px; }

.stack-list { display: grid; gap: 9px; }
.stack-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px;
  background: #fbfdfd;
}
.stack-item strong { display: block; margin-bottom: 3px; }
.stack-item span { color: var(--muted); }
.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.recent-card {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px;
  background: #fbfdfd;
}
.recent-card strong { display: block; margin-bottom: 6px; word-break: break-all; }

.mail-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 16px;
}
.mailbox-pane { min-height: 600px; }
.mailbox-list { display: grid; gap: 8px; margin-top: 12px; max-height: 640px; overflow: auto; }
.mailbox-group {
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
}
.mailbox-group summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  padding: 10px 11px;
  cursor: pointer;
  background: #f2f7f7;
  font-weight: 700;
}
.mailbox-group summary::-webkit-details-marker { display: none; }
.mailbox-group-body { display: grid; gap: 4px; padding: 7px; }
.mailbox-item {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 9px;
  text-align: left;
  color: #33424d;
}
.mailbox-item:hover, .mailbox-item.active { background: var(--primary-soft); color: var(--primary-2); }
.mailbox-item strong { display: block; word-break: break-all; }
.mailbox-item span { color: var(--muted); font-size: 12px; }
.message-list { display: grid; gap: 10px; }
.message-status {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  background: #f2f7f7;
}
.message-item {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 13px;
  background: #fbfdfd;
}
.message-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}
.message-meta strong { font-size: 14px; }
.message-meta span { color: var(--muted); white-space: nowrap; }
.message-item p { margin: 8px 0 0; color: #52616e; line-height: 1.55; }

.rule-rows { display: grid; gap: 9px; margin: 12px 0; }
.rule-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 8px;
}
.result-card, .notice {
  border: 1px solid #9fd8d1;
  background: var(--primary-soft);
  color: #174844;
  border-radius: 9px;
  padding: 12px;
  margin: 12px 0;
  word-break: break-word;
}
.json-details { margin-top: 12px; color: var(--muted); }
.json-details textarea { width: 100%; margin-top: 8px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23,33,43,.34);
}
.drawer-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(560px, 100%);
  background: #fff;
  padding: 18px;
  box-shadow: var(--shadow);
  overflow: auto;
}
.file-drop {
  display: grid;
  place-items: center;
  gap: 8px;
  border: 1px dashed #9fd8d1;
  border-radius: 10px;
  padding: 22px;
  color: var(--primary-2);
  background: var(--primary-soft);
  margin-bottom: 10px;
}
.file-drop input { display: none; }
.import-area {
  width: 100%;
  min-height: 360px;
  margin: 10px 0;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.import-options {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #17212b;
  color: #fff;
  border-radius: 9px;
  padding: 11px 14px;
  box-shadow: var(--shadow);
  z-index: 70;
}
.empty {
  border: 1px dashed var(--border);
  border-radius: 9px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #33424d;
}
.switch input { display: none; }
.switch span {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #cbdadd;
  position: relative;
}
.switch span::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  left: 2px;
  top: 2px;
  transition: transform .15s ease;
}
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(128px, 1fr)); }
  .grid.two, .mail-layout { grid-template-columns: 1fr; }
  .gpt-dashboard { grid-template-columns: repeat(3, minmax(128px, 1fr)); }
  .gpt-workbench { grid-template-columns: 1fr; }
  .gpt-form-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  .converter-grid { grid-template-columns: 1fr; }
  .import-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .mailboxes-panel .toolbar {
    grid-template-columns: minmax(220px, 1fr) minmax(120px, 180px) repeat(3, max-content);
  }
  .invite-panel .panel-head {
    flex-direction: column;
    align-items: stretch;
  }
  .invite-panel .button-row {
    justify-content: flex-start;
  }
  .admin-users-toolbar {
    grid-template-columns: minmax(220px, 1fr) 94px;
  }
  .admin-users-toolbar .pager {
    grid-column: 1 / -1;
  }
  .admin-users-head-actions {
    justify-content: flex-start;
    width: 100%;
  }
  .compact-search {
    flex: 1 1 260px;
  }
}
@media (max-width: 820px) {
  .auth-view { grid-template-columns: 1fr; }
  .auth-intro { display: none; }
  .auth-form-side {
    padding: 48px 20px;
    background:
      radial-gradient(ellipse at 50% 0%, rgba(15,118,110,.14), transparent 52%),
      linear-gradient(180deg, #edf7f5 0%, var(--bg) 100%);
  }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .nav-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace { padding: 14px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .gpt-dashboard { grid-template-columns: 1fr 1fr; }
  .gpt-form-grid { grid-template-columns: 1fr; }
  .wide-field { grid-column: span 1; }
  .import-grid { grid-template-columns: 1fr; }
  .compact-item { grid-template-columns: minmax(0, 1fr) auto; }
  .rule-row { grid-template-columns: 1fr; }
  table { min-width: 920px; }
  .workspace.mailboxes-workspace { overflow: auto; }
  #tab-mailboxes.active { height: auto; overflow: visible; }
  .mailboxes-panel .toolbar { grid-template-columns: 1fr 1fr; }
  .invite-toolbar { grid-template-columns: 1fr; }
  .invite-panel { max-height: none; }
  .admin-users-panel {
    max-height: none;
    min-height: 420px;
  }
  .admin-users-toolbar { grid-template-columns: 1fr; }
  .admin-users-head-actions { width: 100%; }
  .compact-search { min-width: 0; width: 100%; }
}
