/* =========================================================================
   components.css — 按钮 / 徽章 / 表格 / 选择器 / 模态 / Toast
   ========================================================================= */

/* —— 按钮 —— */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 9px 14px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-soft);
  font: 600 13.5px var(--font-sans); cursor: pointer; user-select: none; white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease),
              background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), opacity var(--dur-fast);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn .ico { font-size: 15px; line-height: 1; }

.btn-primary { background: var(--brand-grad); color: #fff; border-color: transparent; box-shadow: var(--shadow-brand); }
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 14px 30px rgba(99,102,241,0.4); }

.btn-ghost { background: var(--brand-soft); color: var(--brand-1); border-color: transparent; }
.btn-ghost:hover { background: color-mix(in srgb, var(--brand-1) 18%, transparent); }

.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: #fff; border-color: transparent; box-shadow: 0 8px 20px rgba(16,185,129,0.3); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; border-color: transparent; box-shadow: 0 8px 20px rgba(239,68,68,0.3); }
.btn-subtle { background: transparent; }

/* —— 徽章（状态）—— */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warn    { background: var(--warn-soft);    color: #b45309; }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-info    { background: var(--info-soft);    color: var(--info); }
.badge-muted   { background: var(--surface-3);    color: var(--muted); }
[data-theme="dark"] .badge-warn { color: #fbbf24; }

/* —— 选择器 / 输入 —— */
.select, .input {
  padding: 8px 12px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 13.5px var(--font-sans); outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.select:focus, .input:focus { border-color: var(--brand-1); box-shadow: 0 0 0 3px var(--brand-ring); }

/* —— 表格 —— */
.table-wrap {
  overflow: auto; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface);
  animation: rise var(--dur-slow) var(--ease-out) both;
}
table.data {
  width: 100%; border-collapse: separate; border-spacing: 0;
  min-width: 1180px; font-size: 13px;
}
table.data thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--th-bg); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  text-align: left; padding: 11px 12px; font-weight: 700; color: var(--text-soft);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td {
  padding: 9px 12px; border-bottom: 1px solid var(--border-soft); white-space: nowrap;
  color: var(--text-soft);
}
table.data tbody tr { transition: background var(--dur-fast); animation: rowin var(--dur) var(--ease-out) both; }
table.data tbody tr:hover { background: var(--row-hover); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.email { font-family: var(--font-mono); color: var(--text); }
table.data td.codes { font-family: var(--font-mono); line-height: 1.5; }
table.data th.select-column, table.data td.select-column { width: 46px; min-width: 46px; padding-left: 14px; padding-right: 8px; text-align: center; }
table.data tbody tr.selected-row { background: var(--brand-soft); }
.table-check { display: inline-grid; place-items: center; width: 20px; height: 20px; cursor: pointer; }
.table-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--brand-1); cursor: pointer; }
.table-check input:disabled { cursor: not-allowed; opacity: .45; }
@keyframes rowin { from { opacity: 0; } to { opacity: 1; } }

/* —— 列表批量操作 —— */
.batch-toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2);
  transition: border-color var(--dur-fast), background var(--dur-fast), box-shadow var(--dur-fast);
}
.batch-toolbar.has-selection { border-color: var(--brand-ring); background: var(--brand-soft); box-shadow: 0 0 0 2px var(--brand-ring); }
.batch-selection { min-width: 88px; display: inline-flex; align-items: baseline; gap: 5px; color: var(--muted); font-size: 12.5px; }
.batch-selection strong { color: var(--brand-1); font-size: 18px; }
.batch-status-control { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
.batch-status-control label { color: var(--text-soft); font-size: 12.5px; font-weight: 600; }
.batch-status-control .select { min-width: 168px; }
.batch-status-control .input { width: min(240px, 100%); }
.batch-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

@media (max-width: 680px) {
  .batch-status-control { flex-basis: 100%; }
  .batch-status-control label { width: 100%; }
  .batch-status-control .select, .batch-status-control .input { flex: 1 1 150px; min-width: 0; }
  .batch-actions { width: 100%; margin-left: 0; }
  .batch-actions .btn { flex: 1; }
}

/* —— 模态 —— */
.modal-mask {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: center; justify-content: center; padding: 18px;
  background: var(--overlay); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.modal-mask.show { display: flex; animation: fade var(--dur) var(--ease) both; }
.modal-box {
  width: min(540px, 100%); max-height: 88vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 20px;
  transform: scale(0.96) translateY(8px); opacity: 0;
  transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur) var(--ease);
}
.modal-mask.show .modal-box { transform: scale(1) translateY(0); opacity: 1; }
.modal-title { font-size: 17px; font-weight: 800; margin-bottom: 8px; }
.modal-message { white-space: pre-wrap; line-height: 1.7; color: var(--text-soft); font-size: 14px; }
.modal-field { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.modal-field .select { width: 100%; box-sizing: border-box; padding: 10px 12px; }
.modal-status { margin-top: 10px; min-height: 18px; color: var(--muted); font-size: 12.5px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.modal-actions .btn { min-width: 88px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* —— 发货自定义导出 —— */
.delivery-box { width: min(820px, 100%); padding: 0; }
.delivery-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 20px 22px 15px; }
.delivery-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.delivery-close { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 26px; line-height: 1; padding: 1px 5px; }
.delivery-close:hover { color: var(--text); }
.delivery-section { padding: 15px 22px; border-top: 1px solid var(--border-soft); }
.delivery-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.delivery-section-head strong { font-size: 13.5px; }
.delivery-section-head small { color: var(--muted); font-size: 11.5px; }
.delivery-section-head span { display: flex; gap: 5px; }
.delivery-section-head button, .age-presets button {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-soft); cursor: pointer;
  border-radius: var(--r-sm); padding: 4px 9px; font: 12px var(--font-sans);
}
.delivery-section-head button:hover, .age-presets button:hover { border-color: var(--brand-1); color: var(--brand-1); }
.format-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.format-option { position: relative; cursor: pointer; }
.format-option input { position: absolute; opacity: 0; pointer-events: none; }
.format-option span { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.format-option small { color: var(--muted); }
.format-option input:checked + span { border-color: var(--brand-1); background: var(--brand-soft); color: var(--brand-1); box-shadow: 0 0 0 2px var(--brand-ring); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 7px 10px; }
.field-grid { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); }
.check-option { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; color: var(--text-soft); font-size: 12.5px; cursor: pointer; }
.check-option input { width: 16px; height: 16px; accent-color: var(--brand-1); }
.check-option.disabled { opacity: .45; }
.delivery-age-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.delivery-age-row label { display: inline-flex; align-items: center; gap: 7px; color: var(--text-soft); font-size: 13px; }
.delivery-age-row .input { width: 108px; }
.delivery-age-row > span { color: var(--muted); }
.age-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.delivery-output-grid { display: grid; grid-template-columns: 1.3fr .8fr 1fr 1fr; gap: 12px; }
.delivery-output-grid > label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
.delivery-output-grid small { color: var(--muted); }
.delivery-header-option { margin: 11px 22px 0; }
.delivery-status { min-height: 20px; margin: 8px 22px 0; color: var(--muted); font-size: 12.5px; }
.delivery-status.success { color: var(--success); }
.delivery-status.error { color: var(--danger); }
.delivery-box .modal-actions { padding: 0 22px 20px; }

@media (max-width: 720px) {
  .format-options { grid-template-columns: repeat(2, 1fr); }
  .delivery-output-grid { grid-template-columns: repeat(2, 1fr); }
  .delivery-head, .delivery-section { padding-left: 16px; padding-right: 16px; }
  .delivery-header-option, .delivery-status { margin-left: 16px; margin-right: 16px; }
  .delivery-box .modal-actions { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 460px) {
  .delivery-output-grid { grid-template-columns: 1fr; }
  .delivery-age-row label { width: 100%; }
  .delivery-age-row .input { flex: 1; }
  .delivery-age-row > span { display: none; }
}

/* —— Toast —— */
.toast-stack {
  position: fixed; right: 18px; bottom: 18px; z-index: 10000;
  display: flex; flex-direction: column; gap: 10px; max-width: min(380px, 92vw);
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  font-size: 13.5px; color: var(--text);
  transform: translateX(120%); opacity: 0;
  transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur);
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast .t-ico { font-size: 16px; line-height: 1.3; }
.toast .t-body { flex: 1; }
.toast .t-title { font-weight: 700; margin-bottom: 2px; }
.toast .t-close { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--info); }
.toast.warn    { border-left: 3px solid var(--warn); }

/* —— 骨架屏（加载占位）—— */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: var(--r-sm);
}
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* —— 登录页 —— */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: var(--bg); position: relative; overflow: hidden;
}
.login-wrap::before, .login-wrap::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.5;
  animation: float 12s ease-in-out infinite;
}
.login-wrap::before { width: 420px; height: 420px; background: radial-gradient(circle, var(--brand-1), transparent 70%); top: -80px; left: -60px; }
.login-wrap::after  { width: 380px; height: 380px; background: radial-gradient(circle, var(--brand-2), transparent 70%); bottom: -90px; right: -50px; animation-delay: -4s; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-24px); } }

.login-card {
  position: relative; z-index: 2; width: min(92vw, 380px);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 26px 22px; box-shadow: var(--shadow-lg);
  animation: rise var(--dur-slow) var(--ease-out) both;
}
.login-card .logo {
  width: 46px; height: 46px; border-radius: var(--r-md); display: grid; place-items: center;
  background: var(--brand-grad); color: #fff; font-size: 22px; margin-bottom: 14px; box-shadow: var(--shadow-brand);
}
.login-card .title { font-size: 21px; font-weight: 800; }
.login-card .sub { color: var(--muted); font-size: 13px; margin: 6px 0 16px; }
.login-card .field { position: relative; margin-top: 12px; }
.login-card .input { width: 100%; padding: 13px 46px 13px 14px; font-size: 15px; }
.login-card .toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; cursor: pointer; padding: 6px 8px; border-radius: var(--r-sm); color: var(--muted);
}
.login-card .toggle:hover { background: var(--surface-3); }
.login-card .btn-primary { width: 100%; margin-top: 16px; padding: 13px; font-size: 15px; justify-content: center; }
.login-card .error {
  color: var(--danger); background: var(--danger-soft); border: 1px solid var(--danger);
  border-radius: var(--r-md); padding: 9px 12px; font-size: 12.5px; margin-bottom: 12px;
  animation: shake var(--dur-slow) var(--ease);
}
.login-card .foot { margin-top: 14px; text-align: center; font-size: 12px; color: var(--muted); }
@keyframes shake { 10%,90% { transform: translateX(-1px); } 20%,80% { transform: translateX(2px); } 30%,50%,70% { transform: translateX(-4px); } 40%,60% { transform: translateX(4px); } }

/* =========================================================================
   EA Signal Console v12 components
   ========================================================================= */
.btn {
  min-height: 38px;
  padding: 8px 13px;
  border-radius: var(--r-sm);
  letter-spacing: 0.01em;
}
.btn-primary {
  color: #101407;
  box-shadow: var(--shadow-brand);
}
[data-theme="light"] .btn-primary { color: #fff; }
.btn-primary:hover { box-shadow: 0 12px 32px rgba(154, 206, 22, 0.24); }
.btn-ghost { border-color: color-mix(in srgb, var(--brand-1) 18%, var(--border)); }
.btn-success {
  background: linear-gradient(112deg, #ffc074, #e9772d);
  color: #211207;
  box-shadow: 0 10px 25px rgba(233, 119, 45, 0.18);
}
.btn-danger { background: linear-gradient(112deg, #ff7a70, #d94a45); }

.theme-toggle {
  min-height: 38px;
  border-radius: var(--r-sm);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 11px;
}

.select, .input {
  min-height: 40px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.badge { border-radius: 5px; font-family: var(--font-mono); font-size: 11px; }
.badge::before { border-radius: 1px; }

.table-wrap {
  border-radius: var(--r-md);
  animation: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}
table.data thead th {
  padding: 13px 12px;
  color: var(--muted);
  font: 700 10px/1.2 var(--font-mono);
  letter-spacing: 0.075em;
  text-transform: uppercase;
}
table.data td { height: 46px; padding: 10px 12px; }
table.data tbody tr { animation: none; }
table.data td.email { font-size: 12px; }
table.data tbody tr.selected-row { box-shadow: inset 2px 0 0 var(--brand-1); }

.batch-toolbar {
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.batch-toolbar.has-selection { box-shadow: inset 3px 0 0 var(--brand-1); }

.modal-mask {
  display: none;
  opacity: 0;
  visibility: hidden;
}
.modal-mask.show {
  display: flex;
  opacity: 1;
  visibility: visible;
  animation: none;
}
.modal-box {
  border-radius: var(--r-lg);
  transform: none;
  opacity: 1;
  transition: none;
}
.modal-mask.show .modal-box { transform: none; opacity: 1; }
.modal-title { font-family: var(--font-display); letter-spacing: -0.025em; }
.delivery-box { border-top: 2px solid var(--brand-1); }
.format-option span { border-radius: var(--r-sm); }

.toast {
  border-radius: var(--r-sm);
  transform: none;
  opacity: 1;
  transition: none;
}
.toast.show { transform: none; opacity: 1; }

/* Login: editorial split-screen rather than a floating generic card. */
.login-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 1px;
  place-items: stretch;
  padding: 0;
  background: var(--border);
}
.login-wrap::before, .login-wrap::after { display: none; }
.login-aside, .login-stage {
  position: relative;
  min-height: 100vh;
  background: var(--bg);
}
.login-aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(28px, 5vw, 78px);
}
.login-aside::before {
  content: "";
  position: absolute;
  left: clamp(28px, 5vw, 78px);
  right: clamp(28px, 5vw, 78px);
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, var(--brand-1), transparent);
  transform: rotate(-9deg);
  transform-origin: left;
  opacity: 0.35;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font: 800 12px/1 var(--font-mono);
  letter-spacing: 0.16em;
}
.login-brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--brand-1);
  border-radius: 50%;
  color: var(--brand-1);
}
.login-copy { position: relative; z-index: 1; max-width: 840px; margin: auto 0; }
.login-copy h1 {
  margin: 16px 0 22px;
  font: 800 clamp(58px, 8vw, 128px)/0.84 var(--font-display);
  letter-spacing: -0.075em;
}
.login-copy h1 span { display: block; color: var(--brand-1); }
.login-copy p { max-width: 500px; color: var(--muted); font-size: 14px; }
.system-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font: 700 10px/1.2 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.login-stage {
  display: grid;
  place-items: center;
  padding: clamp(22px, 4vw, 64px);
  background: var(--surface);
}
.login-card {
  width: min(100%, 420px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  animation: none;
}
.login-card .logo {
  width: auto;
  height: auto;
  margin-bottom: 46px;
  justify-content: start;
  background: none;
  color: var(--brand-1);
  box-shadow: none;
  font: 700 11px/1 var(--font-mono);
  letter-spacing: 0.12em;
}
.login-card .title {
  font: 800 clamp(34px, 4vw, 48px)/1 var(--font-display);
  letter-spacing: -0.045em;
}
.login-card .sub { margin: 10px 0 34px; }
.login-card .field { margin-top: 0; }
.login-card .input { min-height: 56px; border-radius: var(--r-sm); }
.login-card .btn-primary { min-height: 54px; border-radius: var(--r-sm); }
.login-card .foot { margin-top: 30px; text-align: left; font-family: var(--font-mono); }

@media (max-width: 820px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-aside { min-height: 42vh; padding: 28px 22px; }
  .login-copy { margin: 54px 0 32px; }
  .login-copy h1 { font-size: clamp(52px, 17vw, 88px); }
  .login-stage { min-height: 58vh; padding: 48px 22px; }
  .login-card .logo { margin-bottom: 30px; }
}
