/* ==========================================================================
   ai.css — v2 look for the legacy-mounted pages: 登录 / AI 工作台 (#work) /
   今日复盘 (#review). Everything is scoped under .legacy-view so nothing leaks
   into the office screens. Builds on the tokens and base components of
   office.css (.card, .btn, .pill, .seg, .sticky, .topbar, .input …).
   ========================================================================== */

/* 1. Page scaffolding ------------------------------------------------------- */
.legacy-view > .topbar { flex: none; }
.legacy-view > .scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.legacy-view .page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 18px 20px calc(40px + var(--bottom));
}
.legacy-view .page > section { min-width: 0; }
.legacy-view .topbar .pill { transform: rotate(3deg); box-shadow: var(--shadow-1); }

/* Cards in the AI pages carry their own padding + hard shadow. */
.legacy-view .page .card {
  padding: 16px;
  box-shadow: var(--shadow-2);
  min-width: 0;
}

/* Status labels (legacy .chip.chip--blue / --muted): static pill, not a tappable chip. */
.legacy-view .chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 11px;
  border-width: 1.5px;
  box-shadow: none;
}
.legacy-view .chip:hover { background: #fff; }
.legacy-view .chip:active { transform: none; box-shadow: none; }
.legacy-view .chip--blue,
.legacy-view .chip--blue:hover { background: var(--blue-soft); }
/* 今日节奏: 未开工 / 休息日 / 团队已暂停 */
.legacy-view .chip--muted,
.legacy-view .chip--muted:hover { background: var(--rest); color: var(--muted); }

/* 2. Buttons ---------------------------------------------------------------- */
.legacy-view .btn--primary {
  background: var(--blue);
  color: #fff;
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: 19px;
}
.legacy-view .btn--outline { background: #fff; }
.legacy-view .btn--soft { background: var(--sticky); }
.legacy-view .btn--block { display: block; width: 100%; }
.legacy-view .btn--sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  flex: none;
  padding: 7px 12px;
  border-width: 2px;
  border-radius: 12px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--shadow-1);
}
.legacy-view .btn--sm.btn--primary { font-family: var(--font-hand); font-weight: 400; font-size: 16px; }
.legacy-view .btn--sm:active { box-shadow: 1px 1px 0 var(--ink); }
.legacy-view .btn:disabled,
.legacy-view .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.legacy-view .btn:disabled:active { box-shadow: var(--shadow-3); }
.legacy-view .btn--sm:disabled:active { box-shadow: var(--shadow-1); }

/* 3. Login ------------------------------------------------------------------ */
.legacy-view .login {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  min-height: 100%;
  flex: none; /* never shrink below content: overflow must grow the scroller, not spill above it */
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: calc(var(--safe-top) + 40px) 24px calc(28px + var(--bottom));
}
.legacy-view .login__hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-bottom: 6px;
}
.legacy-view .login__title {
  margin: 0;
  font-size: 46px;
  line-height: 1.1;
  letter-spacing: 0.06em;
  text-shadow: 3px 3px 0 var(--yellow);
}
.legacy-view .login__tag { max-width: 290px; align-self: center; }
.legacy-view .login__tag .sticky__text { text-align: center; }
.legacy-view .login__card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: #fff;
}
.legacy-view .login__seg { align-self: stretch; }
.legacy-view .login__seg .seg__opt {
  flex: 1;
  border: 0;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
}
.legacy-view .login__err {
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}
.legacy-view .login__or {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
.legacy-view .login__or span { flex: 1; border-top: 1.5px dashed var(--line-soft); }
.legacy-view .login__legal {
  margin: 0;
  text-align: center;
  font-size: 11px;
  line-height: 1.6;
  color: var(--faint);
}

/* 4. AI pages (工作台 / 复盘) ------------------------------------------------- */
.legacy-view .workbench { gap: 22px; }

.legacy-view .work-hero {
  position: relative;
  background: var(--sticky);
  padding: 20px 18px 16px;
  transform: rotate(-1deg);
  box-shadow: var(--shadow-sticky);
  margin-top: 6px;
}
.legacy-view .work-hero::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 64px;
  height: 18px;
  transform: translateX(-50%) rotate(-3deg);
  background: rgba(58, 134, 255, 0.35);
  border: 1px solid rgba(58, 134, 255, 0.5);
}
.legacy-view .work-kicker {
  display: inline-block;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
  background: var(--ink);
  color: var(--yellow);
  padding: 3px 8px;
  border-radius: 6px;
}
.legacy-view .work-hero h1 {
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.3;
  margin: 10px 0 6px;
}
.legacy-view .work-hero p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted); }

.legacy-view .work-help {
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
  margin: 8px 0;
  overflow-wrap: anywhere;
}
.legacy-view .work-control { display: flex; flex-direction: column; gap: 4px; }
.legacy-view .work-control .row { flex-wrap: wrap; font-size: 13px; font-weight: 700; }
.legacy-view .work-control strong { font-family: var(--font-hand); font-weight: 400; font-size: 20px; }

.legacy-view .work-heading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 12px;
}
.legacy-view .work-heading h2 {
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: 20px;
  line-height: 1.25;
  margin: 0;
}
.legacy-view .work-heading p { font-size: 12px; color: var(--muted); margin: 3px 0 0; line-height: 1.55; }
.legacy-view .work-number {
  flex: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow-1);
  font-family: var(--font-hand);
  font-size: 16px;
  transform: rotate(-3deg);
}

/* Forms */
.legacy-view .work-form { display: flex; flex-direction: column; gap: 14px; }
.legacy-view .work-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 900;
}
.legacy-view .work-form input:not([type="checkbox"]),
.legacy-view .work-form textarea,
.legacy-view .work-form select,
.legacy-view .work-select,
.legacy-view .work-editor textarea {
  width: 100%;
  min-height: 44px;
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 0 12px;
}
.legacy-view .work-form select,
.legacy-view .work-select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 32px;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.legacy-view .work-select { width: auto; min-height: 38px; font-weight: 700; font-size: 13px; }
.legacy-view .work-form textarea,
.legacy-view .work-editor textarea {
  padding: 10px 12px;
  line-height: 1.6;
  resize: vertical;
}
.legacy-view .work-form textarea { min-height: 130px; }
.legacy-view .work-form input::placeholder,
.legacy-view .work-form textarea::placeholder { color: var(--faint); }
.legacy-view .work-form input:focus,
.legacy-view .work-form textarea:focus,
.legacy-view .work-form select:focus,
.legacy-view .work-select:focus,
.legacy-view .work-editor textarea:focus { box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.25); }
.legacy-view :focus-visible { outline: 2.5px solid var(--blue); outline-offset: 2px; }

.legacy-view .work-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.legacy-view .work-form .work-consent {
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  font-weight: 500;
  font-size: 12px;
  line-height: 1.6;
}
.legacy-view .work-consent input {
  width: 18px;
  height: 18px;
  flex: none;
  margin: 2px 0 0;
  accent-color: var(--blue);
}

.legacy-view .work-schedule {
  border-top: 1.5px dashed var(--ink);
  padding-top: 12px;
}
.legacy-view .work-schedule label { margin: 12px 0; }
.legacy-view .work-schedule summary,
.legacy-view details[data-job] summary,
.legacy-view .work-history summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 0;
  list-style-position: inside;
}
.legacy-view .work-history summary { font-size: 12px; color: var(--muted); }

/* Notices */
.legacy-view .work-notice {
  padding: 10px 14px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--blue-soft);
  box-shadow: var(--shadow-1);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}
.legacy-view .work-notice:empty { display: none; }
.legacy-view .work-notice.is-error { background: var(--pink-soft); color: var(--danger); }
.legacy-view .work-error {
  margin: 10px 0;
  padding: 8px 12px;
  background: var(--pink-soft);
  border: 2px solid var(--ink);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

/* Jobs & results */
.legacy-view .work-job { margin: 0 0 14px; }
.legacy-view .work-job h3,
.legacy-view .page .card > h3 {
  font-size: 16px;
  font-weight: 900;
  margin: 10px 0 0;
  overflow-wrap: anywhere;
}
.legacy-view #work-schedules .card { margin: 0 0 14px; }
.legacy-view .work-artifact {
  margin: 8px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.8;
  background: var(--paper);
  border: 1.5px dashed var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  max-height: 480px;
  overflow: auto;
}
.legacy-view .work-artifact--old { max-height: 200px; font-size: 12px; opacity: 0.8; }
.legacy-view .work-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.legacy-view .work-job > .btn--sm { margin-top: 12px; }
.legacy-view .work-history {
  margin-top: 12px;
  border-top: 1.5px dashed var(--line-soft);
  padding-top: 8px;
}
.legacy-view .work-version {
  border-top: 1.5px dashed var(--line-soft);
  padding-top: 10px;
  margin-top: 10px;
}
.legacy-view .work-version .row { flex-wrap: wrap; }
.legacy-view .work-editor textarea { margin-top: 10px; }

/* Empty states: dashed, like the office .empty block. */
.legacy-view .page .work-empty {
  background: transparent;
  border: 2px dashed var(--faint);
  border-radius: 14px;
  box-shadow: none;
  padding: 22px 16px;
  text-align: center;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}

/* 今日复盘 */
.legacy-view .rev-fact { margin: 0 0 12px; }
.legacy-view .rev-fact__text {
  font-size: 14px;
  line-height: 1.7;
  margin: 10px 0;
  overflow-wrap: anywhere;
}
.legacy-view #rev-run { margin-top: 4px; }
.legacy-view .rev-section {
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: 18px;
  margin: 16px 0 6px;
}
.legacy-view .rev-item { border-top: 1.5px dashed var(--line-soft); padding: 10px 0; }
.legacy-view .rev-item p { font-size: 13px; line-height: 1.7; margin: 4px 0; overflow-wrap: anywhere; }
.legacy-view .rev-item .btn--sm { margin-top: 6px; }
.legacy-view #rev-corrections { margin-top: 14px; }

@media (max-width: 360px) {
  .work-columns { grid-template-columns: 1fr; }
  .login__title { font-size: 40px; }
}
