/* AIWord 网页版 —— 小程序的 Web 延展。
 * 移动端 1:1 复刻小程序（rpx 值折半为 px）；≥900px 桌面端参考 Claude：
 * 常驻左侧栏 + 居中内容列，交互逻辑与移动端完全一致。 */

/* ---- 品牌字体（与小程序同源，后端 /assets/fonts 托管） ---- */
@font-face {
  font-family: "AIWord Geist Sans";
  src: url("../assets/fonts/aiword-geist-sans-regular-v1.8.0.ttf") format("truetype");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "AIWord Geist Sans";
  src: url("../assets/fonts/aiword-geist-sans-medium-v1.8.0.ttf") format("truetype");
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: "AIWord Geist Sans";
  src: url("../assets/fonts/aiword-geist-sans-semibold-v1.8.0.ttf") format("truetype");
  font-weight: 600; font-display: swap;
}
@font-face {
  font-family: "AIWord Geist Sans";
  src: url("../assets/fonts/aiword-geist-sans-bold-v1.8.0.ttf") format("truetype");
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: "AIWord MiSans";
  src: url("../assets/fonts/aiword-misans-regular-v2025.woff") format("woff");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "AIWord MiSans";
  src: url("../assets/fonts/aiword-misans-medium-v2025.woff") format("woff");
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: "AIWord MiSans";
  src: url("../assets/fonts/aiword-misans-semibold-v2025.woff") format("woff");
  font-weight: 600; font-display: swap;
}
@font-face {
  font-family: "AIWord MiSans";
  src: url("../assets/fonts/aiword-misans-bold-v2025.woff") format("woff");
  font-weight: 700; font-display: swap;
}

:root {
  --bg: #F9F9F7;
  --card: #FFFFFF;
  --border: #ECEAE3;
  --ink: #262625;
  --ink-2: #57554F;
  --muted: #8F8D85;
  --faint: #A9A69C;
  --accent: #D97757;
  --accent-2: #D77758;
  --accent-press: #C4643F;
  --font: "AIWord Geist Sans", "AIWord MiSans", -apple-system, "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.65;
  letter-spacing: 0.25px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button { font-family: var(--font); border: none; background: none; cursor: pointer; }
input, textarea { font-family: var(--font); border: none; outline: none; background: transparent; color: var(--ink); }
img { -webkit-user-drag: none; user-select: none; }

/* ================= 壳层：侧边栏 + 主视图 ================= */
.shell {
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  position: relative;
}
.sidebar {
  position: absolute;
  inset: 0;
  width: 78%;
  padding: 20px 16px 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.side-brand { padding: 9px 4px 2px; height: 24px; display: flex; align-items: center; }
.side-brand-image { width: 95px; height: auto; display: block; }
.side-profile { padding: 8px 4px 4px; }
.side-tier-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0 14px; cursor: pointer;
}
.tier-badge { font-size: 13px; border-radius: 999px; padding: 3px 13px; }
.tier-free { background: #E4E2DC; color: #666460; }
.tier-pro { background: #D97757; color: #FFFFFF; }
.tier-max { background: #262625; color: #F9F9F7; }
.side-points { flex: 1; font-size: 14px; color: var(--ink-2); }
.side-arrow { color: #C0BEB6; font-size: 18px; }
.side-sec {
  padding: 14px 4px 6px;
  font-size: 12px; letter-spacing: 1px; color: #6F706A; font-weight: 600;
}
.side-tasks { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 16px; }
.side-item {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 8px; border-radius: 8px; cursor: pointer;
}
.side-item:hover, .side-item:active { background: #EFEFEB; }
.side-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 15px; font-weight: 500; color: #4B4C47;
}
.side-status { font-size: 11.5px; flex-shrink: 0; }
.side-status.wait { color: #858680; }
.side-status.doing { color: #D97757; }
.side-status.done { color: #666762; }
.side-status.bad { color: #969791; }
.side-empty { padding: 24px 8px; font-size: 13px; color: var(--faint); }

.main {
  position: absolute;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  transition: transform .28s ease, border-radius .28s ease;
  z-index: 2;
  overflow: hidden;
}
.shell.side-open .main {
  transform: translateX(78%);
  border-radius: 18px;
  box-shadow: -4px 0 30px rgba(50, 40, 30, 0.16);
}
.main-mask { position: absolute; inset: 0; z-index: 10; display: none; }
.shell.side-open .main-mask { display: block; }

.topbar {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 18px 4px;
  flex-shrink: 0;
}
.menu-btn, .back-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
}
.menu-btn:hover, .back-btn:hover { background: #EFEFEB; }
.menu-icon { width: 24px; height: 24px; display: block; }
.back-btn { font-size: 20px; color: var(--ink-2); }
.topbar-title { font-size: 15px; font-weight: 600; color: var(--ink); }

.view {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.view.scroll { overflow-y: auto; display: block; }

/* ================= 首页：新建任务 ================= */
.home-root {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
}
.create-center {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0 18px 75px;
}
.upload-box {
  width: 230px; padding: 52px 0; border-radius: 22px;
  text-align: center; cursor: pointer;
}
.upload-box:hover { opacity: 0.85; }
.upload-box:active { opacity: 0.72; }
.upload-logo { width: 66px; height: 66px; display: block; margin: 0 auto; }
.upload-wordmark { width: 150px; height: auto; display: block; margin: 11px auto 0; }

.composer {
  margin: 0 18px;
  background: #F9F9F9;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 10px 13px 7px;
  box-shadow: 0 2px 10px rgba(25, 26, 23, 0.08);
  flex-shrink: 0;
}
.composer-bottom-space { height: calc(12px + env(safe-area-inset-bottom)); flex-shrink: 0; }

/* 附件条：横向滑动的文件卡片 */
.attach-strip { width: 100%; margin: 1px 0 10px; overflow-x: auto; scrollbar-width: none; }
.attach-strip::-webkit-scrollbar { display: none; }
.attach-row { display: inline-flex; gap: 9px; padding: 2px 1px; }
.attach-card {
  position: relative;
  width: 134px; height: 102px;
  flex-shrink: 0;
  padding: 10px 11px;
  overflow: hidden;
  border: 1px solid #E4E3DE;
  border-radius: 15px;
  background: #F1F1EF;
  display: flex; flex-direction: column; justify-content: space-between;
}
.attach-progress {
  position: absolute; z-index: 0; top: 0; bottom: 0; left: 0;
  background: linear-gradient(90deg, rgba(215,119,88,0.08), rgba(215,119,88,0.22));
  box-shadow: 9px 0 17px rgba(215,119,88,0.18);
  transition: width 180ms ease-out;
}
.attach-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; }
.attach-type {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; font-weight: 500; color: #8A8B85;
}
.attach-type.error { color: #C25B41; }
.attach-card.error { border-color: #E5BBAA; background: #FAF1EC; cursor: pointer; }
.attach-x {
  width: 22px; height: 22px; margin: -4px -5px 0 0;
  text-align: center; line-height: 21px; color: #6B6C67; font-size: 17px; cursor: pointer;
  border-radius: 50%;
}
.attach-x:hover { background: rgba(0,0,0,0.06); }
.attach-name {
  position: relative; z-index: 1;
  color: #333430; font-size: 13px; font-weight: 500; line-height: 1.4;
  word-break: break-all;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; text-overflow: ellipsis;
}

.composer-input {
  width: 100%;
  min-height: 22px; max-height: 130px;
  padding: 0 2px;
  font-size: 16px; line-height: 22px; color: var(--ink);
  resize: none;
}
.composer-input::placeholder { color: #8F8F8A; }
.composer-bar { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.composer-tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.composer-upload {
  width: 36px; height: 36px; border-radius: 50%; background: #EFEFEF;
  display: flex; align-items: center; justify-content: center;
}
.composer-upload:hover { background: #E5E4E0; }
.composer-upload-icon { width: 20px; height: 20px; display: block; }
.agent-chip {
  height: 36px; line-height: 36px; padding: 0 17px; border-radius: 999px;
  background: #EFEFEF; color: #3B3C38; font-size: 12.5px; font-weight: 550; white-space: nowrap;
}
.composer-hint {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; color: var(--faint);
}
.send-btn {
  padding: 0 18px; height: 36px; line-height: 36px; text-align: center;
  border-radius: 999px; background: #EFEFEF; color: #3B3C38;
  font-size: 12.5px; font-weight: 550; flex-shrink: 0;
}
.send-btn.on { background: var(--accent-2); color: #FFFFFF; }
.send-btn.on:hover { background: #C96A4C; }

/* ================= 任务进度页 ================= */
.page { padding: 16px 16px 28px; max-width: 720px; margin: 0 auto; width: 100%; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.head-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.task-no { font-size: 13px; font-weight: 600; color: var(--ink); }
.head-time { font-size: 11px; color: var(--faint); }

.pbar-bg { height: 6px; background: #E8E6DF; border-radius: 999px; overflow: hidden; }
.pbar-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 1s linear; }
.pbar-text { margin-top: 7px; font-size: 12px; color: var(--muted); }
.deduct-line { margin-top: 3px; font-size: 11px; color: var(--faint); }

.banner { border-radius: 8px; padding: 14px; background: #F2F1ED; }
.banner.quota { background: #FAEDE5; }
.banner-title { font-size: 17px; font-weight: 600; color: var(--ink); }
.banner-sub { margin-top: 3px; font-size: 13px; color: var(--muted); }
.banner-actions { display: flex; gap: 10px; }
.dl-btn { margin-top: 12px; flex: 1; }

.timeline { padding: 4px 2px; }
.step { display: flex; }
.step-dot-col { display: flex; flex-direction: column; align-items: center; width: 20px; flex-shrink: 0; }
.step-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; background: #D5D0C4; flex-shrink: 0; }
.step.done .step-dot { background: var(--accent); }
.step.active .step-dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(217,119,87,0.15); }
.step-line { width: 1px; flex: 1; background: var(--border); margin: 4px 0; }
.step-body { flex: 1; padding: 2px 0 15px 10px; min-width: 0; }
.step-title { font-size: 15px; color: var(--faint); }
.step.done .step-title { color: var(--ink); }
.step.active .step-title { color: var(--ink); font-weight: 600; }
.step-spin { color: var(--muted); }
.step-detail { margin-top: 5px; font-size: 12px; color: var(--muted); padding-left: 2px; animation: fadein .6s ease; }
.step-think { margin-top: 5px; font-size: 12px; color: var(--faint); padding-left: 2px; animation: thinkpulse 1.6s ease-in-out infinite; }
.think-dots { letter-spacing: 2px; }
@keyframes thinkpulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes fadein { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.skel-line { height: 14px; border-radius: 4px; background: #EFEEE9; margin-top: 12px; animation: skel 1.2s ease-in-out infinite; }
.skel-line.w60 { width: 60%; }
@keyframes skel { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

.info-row { display: flex; padding: 7px 0; font-size: 14px; }
.info-row .label { width: 75px; color: var(--muted); flex-shrink: 0; }
.info-row .val { flex: 1; color: var(--ink); word-break: break-all; }

.btn-primary {
  display: block; width: 100%;
  background: var(--accent); color: #FFFFFF;
  border-radius: 999px; font-size: 15px; font-weight: 500;
  padding: 9px 0; text-align: center;
}
.btn-primary:hover { background: var(--accent-press); }
.btn-primary:disabled { background: #EAC5B5; cursor: default; }
.btn-plain {
  display: block; width: 100%;
  background: var(--card); color: var(--ink);
  border: 1px solid #CBC5B8; border-radius: 999px; font-size: 14px;
  padding: 8px 0; text-align: center;
}
.btn-plain:hover { background: #F2F1ED; }
.btn-link { display: block; margin: 4px auto; background: none; color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); font-size: 12px; }
.center-empty { text-align: center; padding: 50px 0; }
.empty-title { font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.retry-btn { margin: 16px auto 0; width: 160px; }

/* ================= 会员页 ================= */
.member-page { padding: 14px 16px calc(32px + env(safe-area-inset-bottom)); background: #F3F3F1; min-height: 100%; max-width: 720px; margin: 0 auto; width: 100%; }
.member-hero {
  padding: 17px 17px 15px; border-radius: 17px;
  background: #191A17; color: #FFFFFF;
  box-shadow: 0 6px 17px rgba(25,26,23,0.10);
}
.hero-head { display: flex; align-items: flex-start; justify-content: space-between; }
.hero-kicker { color: rgba(255,255,255,0.58); font-size: 12px; font-weight: 500; }
.hero-tier { margin-top: 1px; font-size: 25px; line-height: 1.2; font-weight: 700; letter-spacing: -0.5px; }
.hero-percent { color: #E28B6E; font-size: 27px; line-height: 1.1; font-weight: 700; }
.hero-percent span { font-size: 12.5px; margin-left: 1px; }
.hero-bar { height: 7px; margin-top: 14px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,0.14); }
.hero-bar-fill { height: 100%; border-radius: 999px; background: var(--accent-2); }
.hero-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 7px; color: rgba(255,255,255,0.62); font-size: 11.5px; }
.hero-running { margin-top: 9px; padding-top: 9px; border-top: 1px solid rgba(255,255,255,0.12); color: #F0B19C; font-size: 11.5px; }

.section-label { margin: 17px 4px 7px; color: #858680; font-size: 13px; font-weight: 500; }
.settings-card { padding: 0 15px; overflow: hidden; border: 1px solid #E9E9E5; border-radius: 15px; background: #FFFFFF; }
.settings-row { min-height: 63px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #E8E8E4; }
.settings-row.last { border-bottom: none; }
.row-copy, .plan-copy { flex: 1; min-width: 0; }
.row-title, .plan-title { color: #191A17; font-size: 15px; font-weight: 600; line-height: 1.35; }
.row-desc { margin-top: 1px; color: #8D8E88; font-size: 11px; line-height: 1.35; }
.row-input { width: 175px; flex-shrink: 0; text-align: right; color: #4A4B46; font-size: 13px; }

.plan-list { display: flex; flex-direction: column; gap: 9px; }
.plan-card { padding: 14px 15px 13px; border: 1px solid #E9E9E5; border-radius: 15px; background: #FFFFFF; }
.plan-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.plan-title-line { display: flex; align-items: center; gap: 6px; }
.plan-title { font-size: 17px; font-weight: 700; }
.current-tag { padding: 1px 7px; border-radius: 999px; background: #F7E6DF; color: #B65C40; font-size: 10px; font-weight: 600; }
.current-tag.dark { background: #E7E7E4; color: #3C3D38; }
.plan-price { flex-shrink: 0; padding-top: 1px; color: #555650; font-size: 13.5px; font-weight: 600; }
.plan-price span { color: #989993; font-size: 10px; font-weight: 400; }
.plan-action {
  width: 100%; height: 33px; margin-top: 12px; border-radius: 999px;
  background: #EFEFEC; color: #3D3E39; font-size: 12px; font-weight: 600; line-height: 33px;
}
.plan-action:hover { background: #E4E4E0; }
.plan-action.max { background: #191A17; color: #FFFFFF; }
.plan-action.max:hover { background: #30312D; }
.member-note { padding: 13px 6px 0; color: #979892; font-size: 11px; line-height: 1.65; }

/* ================= 登录页 ================= */
.login-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--bg);
}
.login-card { width: 100%; max-width: 380px; }
.login-brand { width: 132px; height: auto; display: block; margin: 0 auto 8px; }
.login-title { text-align: center; font-size: 15px; color: var(--muted); margin-bottom: 28px; }
.login-field {
  display: flex; align-items: center; gap: 8px;
  background: #FFFFFF; border: 1px solid var(--border); border-radius: 14px;
  padding: 0 14px; height: 48px; margin-bottom: 12px;
}
.login-field input { flex: 1; font-size: 15px; height: 100%; }
.login-field input::placeholder { color: var(--faint); }
.code-send-btn { flex-shrink: 0; color: var(--accent); font-size: 13px; font-weight: 500; }
.code-send-btn:disabled { color: var(--faint); cursor: default; }
.login-submit { margin-top: 8px; padding: 12px 0; font-size: 15px; }
.login-tip { text-align: center; margin-top: 18px; font-size: 12px; color: var(--faint); }

/* ================= 弹层 / 弹窗 / Toast ================= */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(38,38,37,0.45);
  z-index: 100; display: flex; align-items: flex-end;
}
.sheet {
  width: 100%; background: #FFFFFF; border-radius: 14px 14px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
}
.sheet-title { font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 12px; }
.sheet-row { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid #EFEEE9; }
.sheet-label { width: 70px; color: var(--muted); font-size: 14px; flex-shrink: 0; }
.sheet-input { flex: 1; color: var(--ink); font-size: 15px; }
.sheet-confirm { margin-top: 18px; }
.sheet-skip { text-align: center; color: var(--muted); font-size: 14px; padding-top: 12px; cursor: pointer; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(38,38,37,0.45);
  z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  width: 100%; max-width: 340px; background: #FFFFFF; border-radius: 16px;
  padding: 24px 22px 18px; text-align: center;
}
.modal-title { font-size: 17px; font-weight: 600; color: var(--ink); }
.modal-body { margin-top: 10px; font-size: 14px; color: var(--ink-2); line-height: 1.7; white-space: pre-wrap; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions button { flex: 1; padding: 9px 0; }
.modal-qr { width: 210px; height: 210px; display: block; margin: 14px auto 4px; border-radius: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 12%; transform: translateX(-50%);
  background: rgba(38,38,37,0.92); color: #FFF;
  padding: 10px 18px; border-radius: 10px; font-size: 14px;
  z-index: 300; max-width: 80vw; text-align: center;
  animation: fadein .2s ease;
}

/* ================= 桌面端（Claude 风格） ================= */
@media (min-width: 900px) {
  .shell { display: flex; }
  .sidebar {
    position: static;
    width: 268px; flex-shrink: 0;
    background: #F3F2ED;
    border-right: 1px solid #ECEAE3;
    padding: 18px 14px 0;
  }
  .main { position: static; flex: 1; min-width: 0; }
  .shell.side-open .main { transform: none; border-radius: 0; box-shadow: none; }
  .main-mask { display: none !important; }
  .menu-btn { display: none; }
  .topbar { padding: 14px 26px 4px; }

  /* 新建页：内容整体垂直居中，composer 跟随内容而非贴底 */
  .home-desktop {
    flex: 1; min-height: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 0 40px 6vh;
  }
  .home-desktop .create-center { flex: none; padding: 0 0 30px; }
  .home-desktop .upload-box { width: 300px; padding: 30px 0; }
  .home-desktop .upload-logo { width: 84px; height: 84px; }
  .home-desktop .upload-wordmark { width: 190px; margin-top: 14px; }
  .home-desktop .composer { width: 100%; max-width: 680px; margin: 0; }
  .home-desktop .composer-bottom-space { display: none; }

  .page, .member-page { padding-top: 24px; }
  .sheet-mask { align-items: center; justify-content: center; padding: 24px; }
  .sheet { max-width: 420px; border-radius: 16px; padding: 24px; }
}
