/* 隐私政策生成与发布子页面 — 独立样式表（自根目录 style.css 拷贝，与 agreement/account 页解耦） */

/* ========== 通用 · 与首页统一的 SaaS 工具站 token ========== */
:root {
  --bg-page: #eef2f6;
  --bg-panel: #ffffff;
  --bg-muted: #fafbfc;
  --text-main: #0f172a;
  --text-sub: #64748b;
  --border-soft: #e2e8f0;
  --border-strong: #cbd5e1;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --dur: 0.18s;
  --shadow-panel: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.05);
  --shadow-elevated: 0 4px 16px rgba(15, 23, 42, 0.07);
  --shadow-inset-paper: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.55;
  color: var(--text-main);
  background: linear-gradient(180deg, #f8fafc 0%, var(--bg-page) 32%);
}

/* ========== 生成页：顶栏 ========== */
.site-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
  padding: 0.7rem 1rem 0.8rem;
  text-align: center;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.site-header-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.site-header-main {
  text-align: left;
  padding: 0.2rem 0 0.1rem;
}

.site-title {
  margin: 0 0 0.22rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.site-subtitle {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-sub);
  line-height: 1.45;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-account-entry {
  min-height: 2.1rem;
  padding: 0.34rem 0.78rem;
  font-size: 0.78rem;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.auth-box {
  width: min(312px, 100%);
  text-align: left;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  padding: 0.85rem 0.9rem 0.9rem;
}

.auth-box-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.1rem;
}

.auth-box-icon {
  font-size: 0.95rem;
}

.auth-box-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #2f4a63;
}

.auth-box-desc {
  margin: 0 0 0.45rem;
  font-size: 0.74rem;
  color: #6f8498;
}

.auth-label {
  display: block;
  margin-bottom: 0.22rem;
  font-size: 0.74rem;
  color: #4e6272;
}

.auth-input {
  width: 100%;
  margin-bottom: 0.42rem;
  height: 2.35rem;
  padding: 0 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  background: #f8fafc;
  color: var(--text-main);
}

.auth-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.auth-actions {
  display: flex;
  gap: 0.45rem;
}

.auth-actions .btn {
  flex: 1;
  min-height: 2rem;
  padding: 0.38rem 0.6rem;
  font-size: 0.78rem;
}

.auth-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.45rem 0.52rem;
  border: 1px solid #c5dfca;
  border-radius: 9px;
  background: #f3fbf5;
}

.auth-user-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.auth-user-avatar {
  width: 1.45rem;
  height: 1.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #daf2e0;
}

.auth-user-text {
  margin: 0;
  font-size: 0.79rem;
  color: #1b5e20;
  font-weight: 600;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-status {
  margin: 0.42rem 0 0;
  min-height: 1.15em;
  font-size: 0.75rem;
  color: #5d7385;
}

.auth-status.is-success {
  color: #2e7d32;
}

.auth-status.is-error {
  color: #c62828;
}

.auth-status.is-info {
  color: #1565c0;
}

.account-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.account-auth-panel .auth-box-desc {
  margin-bottom: 0.6rem;
}

.account-links-panel .panel-subtitle {
  margin-bottom: 0.7rem;
}

.account-empty {
  padding: 1.25rem 1rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-sub);
  background: var(--bg-muted);
  font-size: 0.8125rem;
  line-height: 1.55;
}

.my-links-list {
  display: grid;
  gap: 0.65rem;
}

.link-item {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 0.85rem 0.95rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.link-item:hover {
  border-color: #e2e8f0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.link-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.7rem;
}

.link-item-title {
  margin: 0;
  font-size: 0.95rem;
  color: #1f3850;
}

.link-item-time {
  font-size: 0.76rem;
  color: #70859a;
  white-space: nowrap;
}

.link-item-company {
  margin: 0.25rem 0 0.55rem;
  font-size: 0.8rem;
  color: #60788d;
}

.link-item-url {
  margin-bottom: 0.55rem;
}

.link-item-input {
  width: 100%;
  height: 2.35rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  color: #0f172a;
  padding: 0 0.62rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
}

.link-item-actions {
  display: flex;
  gap: 0.45rem;
}

/* ========== 生成页：主体布局 ========== */
.main-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.15rem 1.1rem 2.25rem;
}

.generator-layout {
  display: grid;
  grid-template-columns: minmax(288px, 340px) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.15rem 1.2rem;
  box-shadow: var(--shadow-panel);
}

.panel.panel-form {
  background: var(--bg-muted);
}

.panel.panel-preview {
  background: #fff;
}

.panel-title {
  margin: 0 0 0.3rem;
  font-size: 0.98rem;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.panel-subtitle {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  color: var(--text-sub);
  line-height: 1.45;
}

/* ========== 表单 ========== */
.gen-form .field {
  margin-bottom: 0.85rem;
}

.gen-form .field:last-child {
  margin-bottom: 0;
}

.gen-form label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.3rem;
}

.gen-form input[type="date"],
.gen-form input[type="text"],
.gen-form input[type="email"] {
  width: 100%;
  height: 2.45rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: inherit;
  background: #fff;
  color: #0f172a;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}

.gen-form input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.field-hint {
  display: block;
  min-height: 1.1em;
  margin-top: 0.25rem;
  font-size: 0.76rem;
  color: #c62828;
}

.form-tip {
  margin: 0.68rem 0 0;
  font-size: 0.72rem;
  color: #94a3b8;
  line-height: 1.5;
}

.policy-seo-footnote {
  margin: 0.75rem 0 0;
  font-size: 0.72rem;
  color: #94a3b8;
  line-height: 1.55;
}

.policy-seo-footnote--bottom {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1rem 1.75rem;
}

.policy-seo-footnote a {
  color: var(--primary);
}

.policy-seo-footnote a:hover {
  color: var(--primary-hover);
}

/* ========== 预览区 ========== */
.preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-soft);
}

.preview-toolbar .panel-title {
  margin: 0;
}

.preview-title-wrap .panel-subtitle {
  margin-bottom: 0;
}

.publish-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.22rem;
}

.publish-login-tip {
  margin: 0;
  font-size: 0.72rem;
  color: #6f8596;
}

.preview-box {
  min-height: 260px;
  max-height: min(60vh, 520px);
  overflow: auto;
  padding: 1.35rem 1.45rem;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fdfdfd 0%, #fafbfc 100%);
  font-size: 0.875rem;
  line-height: 1.72;
  box-shadow: var(--shadow-inset-paper), 0 1px 3px rgba(15, 23, 42, 0.04), 0 6px 20px rgba(15, 23, 42, 0.05);
  scrollbar-gutter: stable;
}

.preview-box::-webkit-scrollbar {
  width: 10px;
}

.preview-box::-webkit-scrollbar-thumb {
  background: #d5e2ef;
  border-radius: 8px;
  border: 2px solid #f6faff;
}

.preview-box .policy-doc-title {
  font-size: 1.25rem;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

.publish-result {
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border-soft);
}

.publish-result-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.84rem;
  color: #3f5568;
  font-weight: 600;
}

.publish-result-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.publish-link-icon {
  width: 2.2rem;
  height: 2.2rem;
  flex: 0 0 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ccd9e6;
  border-radius: 10px;
  background: #f3f8ff;
}

.publish-result-input {
  flex: 1;
  min-width: 0;
  height: 2.35rem;
  padding: 0 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color: #0f172a;
  background: #f8fafc;
}

.publish-time {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  color: #7b91a3;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.45rem;
  padding: 0.44rem 1rem;
  font-size: 0.8125rem;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: #1d4ed8;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 2px 6px rgba(37, 99, 235, 0.18);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: #1e40af;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-secondary {
  background: #fff;
  color: #475569;
  border-color: var(--border-soft);
}

.btn-secondary:hover {
  background: #fafbfc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.35rem;
  transform: translateX(-50%);
  padding: 0.55rem 1.1rem;
  background: #1e293b;
  color: #fff;
  font-size: 0.8125rem;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.2);
  z-index: 1000;
  max-width: calc(100% - 2rem);
  text-align: center;
}

.toast[hidden] {
  display: none !important;
}

/* ========== 正式页 agreement ========== */
.page-agreement {
  background: #fff;
}

.agreement-article {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.35rem 1.15rem 2.5rem;
  min-height: 100vh;
}

.agreement-placeholder {
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: var(--text-sub);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.agreement-error {
  padding: 2rem 1.25rem;
  background: #fff3e0;
  border: 1px solid #ffcc80;
  border-radius: 8px;
  color: #e65100;
}

.agreement-error h1 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  color: #bf360c;
}

.agreement-error p {
  margin: 0.5rem 0 0;
}

/* 政策正文排版（预览与正式页共用 class） */
.policy-doc-header {
  margin-bottom: 1.35rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid #e2e8f0;
}

.policy-doc-title {
  margin: 0 0 0.45rem;
  font-size: 1.45rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.policy-doc-meta {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-sub);
  line-height: 1.5;
}

.policy-doc-body h2 {
  margin: 1.25rem 0 0.55rem;
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
}

.policy-doc-body p {
  margin: 0 0 0.75rem;
  text-align: justify;
  hyphens: auto;
  color: #334155;
  word-break: break-word;
  line-height: 1.65;
}

.policy-doc-body a {
  color: var(--primary);
  word-break: break-all;
}

.policy-doc-intro,
.policy-doc-section {
  margin: 0 0 1rem;
}

.policy-doc-subheading {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: #1f3e5b;
}

.policy-doc-notice {
  margin: 0.75rem 0 1rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid #f3d8a8;
  border-radius: 10px;
  background: #fff8ea;
}

.policy-doc-notice p {
  margin: 0;
}

.policy-doc-section-title {
  margin: 1.1rem 0 0.55rem;
  font-size: 1.08rem;
  color: #234763;
}

.policy-doc-subsection-title {
  margin: 0.8rem 0 0.45rem;
  font-size: 0.98rem;
  font-weight: 600;
  color: #2d4f6d;
}

.policy-doc-list-item {
  margin-left: 0.2rem;
  padding-left: 0.3rem;
  border-left: 2px solid #dbe8f4;
}

.policy-doc-meta-line {
  margin: 0 0 0.5rem;
  padding: 0.12rem 0 0.12rem 0.35rem;
  border-left: 2px solid #e4edf6;
  color: #38526a;
}

.sdk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.65rem;
  margin: 0.8rem 0 1rem;
}

.sdk-item {
  border: 1px solid #dce6f0;
  border-radius: 10px;
  background: #f8fbff;
  padding: 0.65rem 0.7rem;
}

.sdk-item h3 {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  color: #1f4264;
}

.sdk-item-title {
  margin: 0 0 0.42rem;
  font-size: 0.93rem;
  color: #173d61;
}

.sdk-item p {
  margin: 0 0 0.32rem;
  font-size: 0.78rem;
  color: #4b647b;
  text-align: left;
}

.sdk-item-meta {
  margin: 0 0 0.36rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: #4b647b;
}

/* ========== 打印 ========== */
@media print {
  .site-header,
  .preview-toolbar .btn,
  .preview-actions,
  .toast {
    display: none !important;
  }

  .preview-box {
    max-height: none;
    border: none;
    padding: 0;
  }

  body.page-generator .panel-preview {
    border: none;
    box-shadow: none;
  }

  body.page-agreement .agreement-article {
    padding: 0;
    max-width: none;
  }
}

/* ========== 移动端 ========== */
@media (max-width: 768px) {
  .site-header-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .site-header-main {
    text-align: center;
  }

  .auth-box {
    width: 100%;
  }

  .header-actions {
    justify-content: center;
  }

  .auth-user {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-user-text {
    max-width: none;
  }

  .generator-layout {
    grid-template-columns: 1fr;
  }

  .account-layout {
    grid-template-columns: 1fr;
  }

  .preview-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .publish-cta {
    align-items: stretch;
  }

  .publish-login-tip {
    text-align: center;
  }

  .preview-toolbar .btn-primary {
    width: 100%;
  }

  .publish-result-row {
    flex-direction: column;
    align-items: stretch;
  }

  .publish-link-icon {
    width: 100%;
    height: 2rem;
    flex: none;
  }

  .publish-result-row .btn {
    width: 100%;
  }

  .policy-doc-title {
    font-size: 1.45rem;
  }

  .link-item-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .link-item-actions .btn {
    flex: 1;
  }
}
