/* ============================================================
   TaxWise 全局样式
   从 base.html 提取，与 Tailwind CDN 配合使用
   ============================================================ */

[x-cloak] { display: none !important; }
* { -webkit-font-smoothing: antialiased; }

/* 滚动条 */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 9999px; }

/* 侧边栏过渡 */
.sidebar { transition: width .22s cubic-bezier(.4,0,.2,1); }

/* 导航激活态 */
.nav-item { position: relative; }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; background: #60a5fa; border-radius: 0 3px 3px 0;
}

/* 标签徽章 */
.tag-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 9999px;
  font-size: 0.7rem; font-weight: 500; letter-spacing: .01em;
}

/* 卡片 */
.card { background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04); }
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); transition: box-shadow .2s; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px;
       border-radius: 8px; font-size: .875rem; font-weight: 500; transition: all .15s; cursor: pointer; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; box-shadow: 0 2px 8px rgba(37,99,235,.35); }
.btn-secondary { background: #fff; color: #374151; border: 1px solid #e5e7eb; }
.btn-secondary:hover { background: #f9fafb; border-color: #d1d5db; }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: .8125rem; border-radius: 6px; }

/* 输入框 */
.input { width: 100%; padding: 8px 12px; border: 1px solid #e5e7eb; border-radius: 8px;
         font-size: .875rem; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }

/* 状态徽章 */
.badge { display: inline-flex; align-items: center; padding: 3px 10px;
         border-radius: 9999px; font-size: .75rem; font-weight: 500; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-purple { background: #ede9fe; color: #5b21b6; }

/* 表格 */
.data-table th { background: #f8fafc; font-weight: 600; font-size: .8125rem;
                 color: #6b7280; text-transform: uppercase; letter-spacing: .04em; }
.data-table tr:hover td { background: #f8fafc; }

/* Quill 编辑器 */
#quill-editor { height: 520px; border-radius: 0 0 8px 8px; }
.ql-toolbar { border-radius: 8px 8px 0 0; border-color: #e5e7eb !important; }
.ql-container { font-size: 15px; border-color: #e5e7eb !important; }

/* 页面过渡 */
main { animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: .6; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Toast 动画 */
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(16px); } }

.app-shell { height: 100vh; height: 100dvh; }
.app-main { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 0.75rem); }
.safe-toast-top { top: calc(env(safe-area-inset-top, 0px) + 4rem); }
.safe-toast-bottom { bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem); }

/* 移动端适配 */
@media (max-width: 1023px) {
  .data-table { min-width: 760px; }
  .mobile-scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── AI 助手抽屉 ── */
.ai-drawer {
  position: fixed; top: 0; right: 0;
  /* dvh 随键盘弹起收缩（iOS 15.4+ / Android Chrome），旧设备回退 100% */
  height: 100%; height: 100dvh;
  width: 100%; /* 移动端全屏宽 */
}
@media (min-width: 480px) { .ai-drawer { width: 20rem; } }
@media (min-width: 640px) { .ai-drawer { width: 24rem; } }
.ai-drawer.ai-drawer--fullscreen { inset: 0; width: 100% !important; height: 100%; height: 100dvh; }

/* 消息滚动区：iOS 惯性滚动 + 防止过渡滚动透传 */
.ai-msg-area { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

/* 防止 iOS Safari 在 font-size < 16px 的输入框聚焦时自动缩放页面 */
@media (max-width: 767px) {
  .ai-chat-input { font-size: 16px !important; line-height: 1.5; }
}

/* AI Chat Page 移动端安全区域（viewport-fit=cover 时补偿刘海/Home 条）*/
.ai-mobile-header {
  padding-top: max(0.75rem, env(safe-area-inset-top, 0px));
}
.ai-input-bar {
  padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
}

/* ── AI 助手消息 Markdown 样式 ── */
.ai-prose { line-height: 1.6; }
.ai-prose p { margin: 0.3em 0; }
.ai-prose p:first-child { margin-top: 0; }
.ai-prose p:last-child  { margin-bottom: 0; }
.ai-prose ul, .ai-prose ol { padding-left: 1.25em; margin: 0.3em 0; }
.ai-prose ul { list-style-type: disc; }
.ai-prose ol { list-style-type: decimal; }
.ai-prose li { margin: 0.15em 0; }
.ai-prose strong { font-weight: 600; }
.ai-prose em { font-style: italic; }
.ai-prose h1,.ai-prose h2,.ai-prose h3 { font-weight: 600; margin: 0.5em 0 0.2em; }
.ai-prose code {
  background: #f1f5f9; color: #0f172a;
  padding: 0.1em 0.3em; border-radius: 0.25rem;
  font-size: 0.85em; font-family: monospace;
}
.ai-prose pre {
  background: #f1f5f9; padding: 0.6em 0.8em;
  border-radius: 0.375rem; overflow-x: auto; margin: 0.4em 0;
}
.ai-prose pre code { background: none; padding: 0; }
.ai-prose blockquote {
  border-left: 3px solid #c7d2fe; padding-left: 0.75em;
  margin: 0.3em 0; color: #64748b;
}
.ai-prose hr { border: none; border-top: 1px solid #e2e8f0; margin: 0.5em 0; }

/* ── 登录页（login.html） ── */
.input-field {
  width: 100%; padding: 10px 14px; border: 1.5px solid #e5e7eb;
  border-radius: 10px; font-size: .875rem; outline: none; transition: all .15s;
  background: #f9fafb;
}
.input-field:focus { border-color: #3b82f6; background: #fff; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.btn-login {
  width: 100%; padding: 11px; background: #2563eb; color: #fff;
  border-radius: 10px; font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: all .15s; border: none;
}
.btn-login:hover { background: #1d4ed8; box-shadow: 0 4px 14px rgba(37,99,235,.4); transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }
.btn-wechat {
  width: 100%; padding: 11px; background: #fff; color: #1a7c3c;
  border: 1.5px solid #22c55e; border-radius: 10px; font-size: .875rem; font-weight: 500;
  cursor: pointer; transition: all .15s; display: flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
}
.btn-wechat:hover { background: #f0fdf4; border-color: #16a34a; }

/* ── 邮件模板编辑器（mailer/template_form.html） ── */
.html-editor { font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace; font-size: 13px; line-height: 1.6; }

/* ── 公开政策详情页（policy/public_detail.html） ── */
.prose { line-height: 1.75; }
.prose p { margin-bottom: 1em; }
.prose h1, .prose h2, .prose h3 { font-weight: 600; margin: 1.2em 0 0.5em; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.prose th, .prose td { border: 1px solid #e5e7eb; padding: 6px 10px; text-align: left; font-size: 0.875rem; }
.prose th { background: #f9fafb; font-weight: 600; }
.prose img { max-width: 100%; height: auto; border-radius: 6px; }
.prose a { color: #3b82f6; text-decoration: underline; }

