/* 共享基础组件、弹层、灯箱与档案及合规页样式 */

.ico {
  flex-shrink: 0;
  vertical-align: middle;
}

/* 卡片（克制：最多一层，1px 暖边框，12px 圆角，默认无阴影） */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 20px;
}

/* 按钮体系 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--ink-primary);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: var(--bg-subtle);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #FFFFFF;
}

[data-theme="dark"] .btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #13221D;
  font-weight: 600;
}

[data-theme="dark"][data-subject="en"] .btn-primary {
  color: #121521;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  color: #FFFFFF;
}

[data-theme="dark"] .btn-primary:hover:not(:disabled) {
  background: #67B8A0;
  border-color: #67B8A0;
  color: #10201B;
}

[data-theme="dark"][data-subject="en"] .btn-primary:hover:not(:disabled) {
  background: #B8C6F0;
  border-color: #B8C6F0;
  color: #121521;
}

.btn-soft {
  background: var(--brand-soft);
  border-color: transparent;
  color: var(--brand);
}

.btn-soft:hover:not(:disabled) {
  background: color-mix(in srgb, var(--brand-soft) 75%, var(--brand-border));
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--ink-primary);
}

.btn-danger {
  background: var(--redpen-soft);
  border-color: var(--redpen-border);
  color: var(--redpen);
}

.btn-danger:hover:not(:disabled) {
  background: var(--redpen);
  border-color: var(--redpen);
  color: #FFFFFF;
}

.btn-sm {
  min-height: 32px;
  padding: 0 11px;
  font-size: 13px;
  gap: 5px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--ink-primary);
}

.icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Chip 选择胶囊 */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  color: var(--ink-secondary);
  font-size: 13px;
  line-height: 1.4;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--ink-primary);
  background: var(--bg-subtle);
}

.chip.on {
  background: var(--brand-soft);
  border-color: var(--brand-border);
  color: var(--brand);
  font-weight: 600;
}

/* 标签徽章 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-soft);
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}

.tag-brand {
  background: var(--brand-soft);
  border-color: var(--brand-border);
  color: var(--brand);
}

.tag-core {
  background: var(--diff-add-bg);
  border-color: color-mix(in srgb, var(--diff-add-ink) 28%, transparent);
  color: var(--diff-add-ink);
}

.tag-polish {
  background: var(--brand-soft);
  border-color: var(--brand-border);
  color: var(--brand);
}

.tag-fix {
  background: var(--redpen-soft);
  border-color: var(--redpen-border);
  color: var(--redpen);
}

.tag-ph {
  background: var(--diff-ph-bg);
  border-color: var(--diff-ph-border);
  color: var(--diff-ph-ink);
}

/* 分段控件 */
.seg {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: var(--bg-subtle);
}

.seg > button {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.seg > button:hover {
  color: var(--ink-primary);
}

.seg > button.on,
.seg > button[aria-selected="true"],
.seg > button[aria-pressed="true"] {
  background: var(--bg-card);
  color: var(--ink-primary);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(30, 36, 33, 0.06);
}

/* 开关组件 */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: var(--ink-secondary);
}

.switch input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 38px;
  height: 22px;
  margin: 0;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease;
  flex-shrink: 0;
}

.switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  transition: transform 0.16s ease;
}

.switch input:checked {
  background: var(--brand);
  border-color: var(--brand);
}

.switch input:checked::after {
  transform: translateX(16px);
  border-color: transparent;
  background: #FFFFFF;
}

/* 表单域 */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-primary);
  line-height: 1.4;
}

.field-hint {
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.6;
}

.field-error {
  font-size: 13px;
  color: var(--redpen);
  line-height: 1.5;
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--ink-primary);
  font-size: 15px;
  line-height: 1.6;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--ink-muted);
}

.textarea {
  resize: vertical;
  min-height: 92px;
  line-height: 1.8;
}

.select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%),
    linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* 空状态 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 44px 24px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-strong);
  background: var(--bg-card);
}

.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand);
}

.empty-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-primary);
}

.empty-desc {
  max-width: 420px;
  font-size: 14px;
  color: var(--ink-secondary);
  line-height: 1.75;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
}

/* Toast 悬浮提示 */
#toast-host {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1400;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 420px;
}

.toast {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--ink-primary);
  color: var(--bg-paper);
  font-size: 14px;
  line-height: 1.5;
  box-shadow: var(--shadow-float);
  animation: fade-up 0.18s ease;
  cursor: pointer;
}

.toast-success {
  background: var(--brand-deep);
  color: #FFFFFF;
}

.toast-error {
  background: var(--redpen);
  color: #FFFFFF;
}

.toast-warning {
  background: #8A5410;
  color: #FFFFFF;
}

/* 弹层与底部抽屉（宽屏居中，窄屏抽屉） */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--scrim);
  animation: fade-in 0.16s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sheet {
  width: 100%;
  max-width: 480px;
  max-height: min(86dvh, 720px);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  box-shadow: var(--shadow-sheet);
  overflow: hidden;
  animation: fade-up 0.18s ease;
}

.sheet-wide {
  max-width: 640px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.sheet-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-primary);
  line-height: 1.4;
}

.sheet-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  line-height: 1.78;
}

.sheet-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-subtle);
  flex-shrink: 0;
}

@media (max-width: 679px) {
  .sheet-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .sheet,
  .sheet-wide {
    max-width: 100%;
    max-height: 88dvh;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* 图片灯箱 */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  background: rgba(15, 16, 15, 0.92);
  color: #F5F2EB;
  animation: fade-in 0.16s ease;
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 54px;
  padding: 0 16px;
  flex-shrink: 0;
}

.lightbox-counter {
  font-size: 14px;
  color: rgba(245, 242, 235, 0.85);
}

.lightbox-hint {
  font-size: 13px;
  color: rgba(245, 242, 235, 0.65);
}

.lightbox-bar .icon-btn {
  color: #F5F2EB;
}

.lightbox-bar .icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
}

.lightbox-stage {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 12px 56px 24px;
}

.lightbox-img {
  max-width: 100%;
  max-height: calc(100dvh - 104px);
  border-radius: 6px;
  object-fit: contain;
  cursor: zoom-in;
  transition: transform 0.2s ease;
  user-select: none;
}

.lightbox-img.zoomed {
  max-width: none;
  max-height: none;
  width: min(1600px, 185vw);
  cursor: zoom-out;
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(25, 28, 26, 0.68);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 1205;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
  left: 14px;
}

.lightbox-next {
  right: 14px;
}

@media (max-width: 679px) {
  .lightbox-stage {
    padding: 8px 12px 24px;
  }
  .lightbox-hint {
    display: none;
  }
}

/* 档案与设置页 */
.profile-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.profile-section-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-primary);
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.account-phone {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.quota-box {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--brand-border);
  background: var(--brand-soft);
}

.quota-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.quota-num {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--brand);
}

.quota-bar {
  height: 7px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--brand) 16%, transparent);
  overflow: hidden;
}

.quota-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--brand);
  transition: width 0.25s ease;
}

.child-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.child-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: var(--bg-paper);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.child-item:hover {
  border-color: var(--border-strong);
}

.child-item.current {
  border-color: var(--brand-border);
  background: var(--brand-soft);
}

.child-item-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.child-item-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.child-item-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-primary);
}

.child-item-note {
  font-size: 13px;
  color: var(--ink-secondary);
}

.child-item-ops {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.menu-list {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 15px 20px;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  background: transparent;
  color: var(--ink-primary);
  text-align: left;
  transition: background-color 0.12s ease;
}

.menu-item:last-child {
  border-bottom: 0;
}

.menu-item:hover {
  background: var(--bg-subtle);
}

.menu-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.menu-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-item-title {
  font-size: 15px;
  font-weight: 500;
}

.menu-item-sub {
  font-size: 13px;
  color: var(--ink-muted);
}

.menu-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.danger-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* 海报预览 */
.poster-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.poster-canvas {
  width: 100%;
  max-width: 320px;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-float);
}

/* 协议页 */
.legal-tabs {
  margin-bottom: 20px;
}

.legal-tabs .seg {
  width: 100%;
}

.legal-article {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.legal-article h2 {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.45;
}

.legal-article h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand);
  margin-top: 6px;
}

.legal-article p,
.legal-article li {
  color: var(--ink-secondary);
  line-height: 1.85;
}

.legal-article ul {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legal-meta {
  font-size: 13px;
  color: var(--ink-muted);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}
