/* amzlaochen 基础样式：只用 theme/tokens.css 里的 --ps-* 令牌，和自动化生产线保持同一套外观。 */
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--ps-bg); }
body { margin: 0; background: var(--ps-bg); color: var(--ps-text); font: 14px/1.5 var(--ps-font); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ps-primary-text); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ps-primary-active); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 14px;
  border: 1px solid var(--ps-border-strong); border-radius: var(--ps-radius-control); background: var(--ps-surface);
  color: var(--ps-text-2); font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background var(--ps-fast) var(--ps-ease), border-color var(--ps-fast) var(--ps-ease); }
.btn:hover:not(:disabled) { background: var(--ps-surface-muted); color: var(--ps-text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--ps-primary); border-color: var(--ps-primary); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--ps-primary-hover); border-color: var(--ps-primary-hover); color: #fff; }
.btn.danger { border-color: var(--ps-danger-border); color: var(--ps-danger); }
.btn.danger:hover:not(:disabled) { background: var(--ps-danger-bg); color: var(--ps-danger); }
.btn.small { min-height: 28px; padding: 0 10px; font-size: 12px; }
.btn.block { width: 100%; }
.btn.feishu { border-color: #3370ff; color: #fff; background: #3370ff; }
.btn.feishu:hover:not(:disabled) { background: #245bdb; border-color: #245bdb; color: #fff; }

/* forms */
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field > span { color: var(--ps-text-2); font-size: 13px; font-weight: 500; }
.field small { color: var(--ps-text-muted); font-size: 12px; }
.input, select.input, textarea.input { width: 100%; min-height: 36px; padding: 6px 10px; border: 1px solid var(--ps-border-strong);
  border-radius: var(--ps-radius-control); background: var(--ps-surface); }
textarea.input { min-height: 96px; resize: vertical; font-family: var(--ps-mono); font-size: 13px; }
.input:focus { border-color: var(--ps-primary-active); outline: none; box-shadow: 0 0 0 3px var(--ps-primary-tint); }

/* notices and tags */
.notice { padding: 10px 12px; border: 1px solid var(--ps-info-border); border-radius: var(--ps-radius-control);
  background: var(--ps-info-bg); color: var(--ps-text); font-size: 13px; }
.notice.error { background: var(--ps-danger-bg); border-color: var(--ps-danger-border); color: var(--ps-danger); }
.notice.ok { background: var(--ps-success-bg); border-color: var(--ps-success-border); color: var(--ps-success); }
.notice.warn { background: var(--ps-warning-bg); border-color: var(--ps-warning-border); color: var(--ps-warning); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border: 1px solid var(--ps-neutral-border);
  border-radius: 999px; background: var(--ps-neutral-bg); color: var(--ps-neutral); font-size: 12px; white-space: nowrap; }
.tag.ok { background: var(--ps-success-bg); border-color: var(--ps-success-border); color: var(--ps-success); }
.tag.warn { background: var(--ps-warning-bg); border-color: var(--ps-warning-border); color: var(--ps-warning); }
.tag.off { background: var(--ps-danger-bg); border-color: var(--ps-danger-border); color: var(--ps-danger); }
.tag.brand { background: var(--ps-primary-soft); border-color: var(--ps-border-accent); color: var(--ps-primary-text); }

/* cards and tables */
.card { background: var(--ps-surface); border: 1px solid var(--ps-border); border-radius: var(--ps-radius-card); box-shadow: var(--ps-shadow-1); }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th, table.grid td { padding: 8px 12px; border-bottom: 1px solid var(--ps-border); text-align: left; vertical-align: middle; }
table.grid th { background: var(--ps-surface-muted); color: var(--ps-text-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid td.actions { white-space: nowrap; text-align: right; }
table.grid td.actions .btn + .btn { margin-left: 6px; }
.muted { color: var(--ps-text-muted); }
.mono { font-family: var(--ps-mono); font-size: 12px; }
.empty-row { padding: 28px 12px; text-align: center; color: var(--ps-text-muted); }

/* dialog */
dialog.dlg { width: min(480px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--ps-border); border-radius: var(--ps-radius-card);
  background: var(--ps-surface); box-shadow: var(--ps-shadow-dialog); }
dialog.dlg::backdrop { background: var(--ps-backdrop); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--ps-border); }
.dlg-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.dlg-body { padding: 16px 18px 4px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; }
.secret-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px dashed var(--ps-primary);
  border-radius: var(--ps-radius-control); background: var(--ps-primary-soft); font-family: var(--ps-mono); font-size: 15px; letter-spacing: .04em; }

/* toast */
.toast-host { position: fixed; z-index: 200; right: 16px; bottom: 16px; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast-msg { padding: 10px 14px; border-radius: var(--ps-radius-control); background: var(--ps-text); color: #fff; box-shadow: var(--ps-shadow-2); font-size: 13px; }
.toast-msg.error { background: var(--ps-danger-solid); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
