/* ------------------------------- workbench ------------------------------- */
body.app {
  background-color: var(--paper);
  background-image: radial-gradient(rgba(27, 23, 20, 0.08) 1px, transparent 1px);
  background-size: 22px 22px;
}

.app-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 18px;
  background:
    radial-gradient(circle at 20% 0%, rgba(126, 209, 188, 0.18), transparent 45%),
    var(--ink);
  color: var(--paper);
  border-right: 2px solid var(--line);
  z-index: 20;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px;
}

.rail-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
  transform: rotate(-3deg);
  overflow: hidden;
  flex-shrink: 0;
}

.rail-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rail-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.rail-brand-text strong {
  font-family: var(--font-display);
  font-size: 18px;
}

.rail-brand-text small {
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: rgba(255, 249, 239, 0.55);
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rail-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1.5px solid transparent;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 249, 239, 0.68);
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.rail-nav a:hover {
  background: rgba(255, 249, 239, 0.08);
  color: var(--paper);
}

.rail-nav a.is-active {
  background: var(--paper);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 249, 239, 0.12);
  font-style: normal;
  font-size: 13px;
  flex-shrink: 0;
}

.rail-nav a.is-active .nav-icon {
  background: var(--sun);
}

.rail-note {
  margin-top: auto;
  padding: 13px;
  border: 1.5px dashed rgba(255, 249, 239, 0.28);
  border-radius: 12px;
  background: rgba(255, 249, 239, 0.04);
}

.rail-note-tag {
  display: inline-block;
  margin-bottom: 6px;
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--mint);
  color: var(--ink);
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.rail-note p {
  font-size: 11.5px;
  line-height: 1.6;
  color: rgba(255, 249, 239, 0.62);
}

.rail-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-top: 16px;
  border-top: 1.5px solid rgba(255, 249, 239, 0.16);
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sun);
  border: 2px solid var(--paper);
  color: var(--ink);
  font-weight: 900;
  font-size: 14px;
  flex-shrink: 0;
}

.rail-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.rail-user-info strong {
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-user-info small {
  font-size: 10px;
  color: rgba(255, 249, 239, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-logout {
  flex-shrink: 0;
  margin-left: auto;
  padding: 5px 9px;
  border: 1.5px solid rgba(255, 249, 239, 0.3);
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 249, 239, 0.7);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.rail-logout:hover {
  border-color: var(--coral);
  color: #fff;
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-top {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 66px;
  padding: 0 clamp(18px, 3vw, 34px);
  background: rgba(255, 249, 239, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--line);
}

.crumbs {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.top-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-faint);
}

.top-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #39a878;
  box-shadow: 0 0 0 3px rgba(57, 168, 120, 0.18);
}

.top-status.is-off i {
  background: var(--coral);
  box-shadow: 0 0 0 3px rgba(226, 96, 61, 0.2);
}

.mobile-nav {
  display: none;
}

.mobile-logout {
  display: none;
}

.view {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 34px) clamp(16px, 3vw, 34px) 70px;
  outline: none;
}

/* ------------------------------- shared panels ------------------------------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-head h1 {
  font-size: clamp(26px, 3.4vw, 38px);
  letter-spacing: -0.03em;
}

.page-head p {
  margin-top: 7px;
  font-size: 13.5px;
  color: var(--ink-soft);
  max-width: 620px;
}

.breadcrumb-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-faint);
}

.breadcrumb-back:hover {
  color: var(--coral-deep);
}

.panel {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  margin-bottom: 20px;
  border: 2px solid var(--coral);
  border-radius: 13px;
  background: var(--coral-soft);
  font-size: 13px;
  font-weight: 600;
  color: #8b2f14;
}

.banner.ok {
  border-color: #2f9c74;
  background: #e2f6ee;
  color: #155f45;
}

.banner b {
  font-weight: 900;
}

.loading-panel,
.empty-state {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 70px 20px;
  text-align: center;
  color: var(--ink-faint);
}

.loading-panel p,
.empty-state p {
  font-size: 13.5px;
}

.empty-state h3 {
  font-size: 20px;
  color: var(--ink);
}

.empty-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 66px;
  height: 66px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--paper-deep);
  font-size: 26px;
  box-shadow: var(--shadow-sm);
}

.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(27, 23, 20, 0.16);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ------------------------------- dashboard ------------------------------- */
.hello-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
  gap: 24px;
  padding: clamp(22px, 3.4vw, 36px);
  margin-bottom: 26px;
  border: 2px solid var(--line);
  border-radius: 24px;
  background: var(--sun);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hello-card::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -70px;
  width: 240px;
  height: 240px;
  border: 2px dashed rgba(27, 23, 20, 0.2);
  border-radius: 50%;
}

.hello-eyebrow {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  color: rgba(27, 23, 20, 0.6);
}

.hello-card h1 {
  margin: 8px 0 8px;
  font-size: clamp(26px, 3.6vw, 40px);
}

.hello-card p {
  max-width: 460px;
  font-size: 13.5px;
  color: rgba(27, 23, 20, 0.72);
}

.hello-meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 16px;
}

.hello-meta span {
  padding: 4px 10px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  font-weight: 700;
}

.hello-streak {
  position: relative;
  z-index: 1;
  align-self: end;
  justify-self: end;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  transform: rotate(2deg);
  max-width: 220px;
}

.hello-streak strong {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
}

.hello-streak span {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--ink-faint);
}

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px;
  border: 2px solid var(--line);
  border-radius: 20px;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  overflow: hidden;
}

.tile:hover {
  transform: translateY(-3px);
  box-shadow: 6px 8px 0 rgba(27, 23, 20, 0.15);
}

.tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tile-badge {
  padding: 3px 9px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: var(--coral-soft);
}

.tile:nth-child(2) .tile-badge {
  background: var(--mint-soft);
}

.tile h3 {
  font-size: 21px;
}

.tile p {
  font-size: 12.5px;
  color: var(--ink-soft);
  flex: 1;
}

.tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tile-link {
  font-size: 12.5px;
  font-weight: 900;
  color: var(--coral-deep);
}

.tile-link::after {
  content: " →";
}

.tile:nth-child(2) .tile-link {
  color: #15705c;
}

.tile-state {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink-faint);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 14px;
}

.section-title h2 {
  font-size: 20px;
}

.section-title a {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-faint);
}

.section-title a:hover {
  color: var(--coral-deep);
}

.recent-list {
  display: grid;
  gap: 10px;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 16px;
  border: 2px solid rgba(27, 23, 20, 0.14);
  border-radius: 14px;
  background: var(--white);
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.recent-item:hover {
  border-color: var(--line);
  transform: translateX(2px);
}

.recent-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--coral);
  flex-shrink: 0;
}

.recent-dot.cover {
  background: var(--mint);
}

.recent-title {
  min-width: 0;
  flex: 1;
}

.recent-title strong {
  display: block;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-title small {
  font-size: 11px;
  color: var(--ink-faint);
}

.status-pill {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--paper-deep);
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink-soft);
  white-space: nowrap;
}

.status-pill.done { background: #e2f6ee; color: #155f45; }
.status-pill.running { background: #fff2c6; color: #7a5a00; }
.status-pill.failed { background: var(--coral-soft); color: #8b2f14; }

/* ------------------------------- forms ------------------------------- */
.form-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
  align-items: start;
}

.form-card {
  padding: clamp(20px, 3vw, 30px);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.form-block {
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 2px dashed rgba(27, 23, 20, 0.14);
}

.form-block:last-of-type {
  border-bottom: 0;
  margin-bottom: 10px;
  padding-bottom: 0;
}

.block-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
}

.block-index {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  color: var(--coral);
}

.block-head h2 {
  font-size: 17px;
}

.block-head p {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--ink-faint);
}

.form-grid {
  display: grid;
  gap: 15px;
}

.form-grid.two {
  grid-template-columns: 1fr 1fr;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 16px;
  border: 2px solid rgba(27, 23, 20, 0.22);
  border-radius: 13px;
  background: var(--paper);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.mode-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-card strong {
  font-size: 14px;
}

.mode-card span {
  font-size: 11.5px;
  color: var(--ink-faint);
  line-height: 1.5;
}

.mode-card:has(input:checked) {
  border-color: var(--line);
  background: var(--sun);
  box-shadow: var(--shadow-sm);
}

.mode-card:has(input:focus-visible) {
  outline: 3px solid var(--coral);
  outline-offset: 2px;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented label {
  position: relative;
  padding: 8px 16px;
  border: 2px solid rgba(27, 23, 20, 0.2);
  border-radius: 999px;
  background: var(--paper);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented label:has(input:checked) {
  background: var(--ink);
  border-color: var(--line);
  color: var(--paper);
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.char-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 2px solid rgba(27, 23, 20, 0.18);
  border-radius: 11px;
  background: var(--paper);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.char-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.char-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  flex-shrink: 0;
}

.char-dot.yellow { background: #ffe37a; }
.char-dot.black { background: #3a3330; }
.char-dot.pink { background: #ffb6cf; }
.char-dot.blue { background: #8ec8f0; }
.char-dot.red { background: #ef7d66; }
.char-dot.cyan { background: #8fe0c5; }

.char-chip:has(input:checked) {
  border-color: var(--line);
  background: var(--mint-soft);
  box-shadow: var(--shadow-sm);
}

.tip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.tip-chip {
  padding: 4px 10px;
  border: 1.5px dashed rgba(27, 23, 20, 0.26);
  border-radius: 999px;
  background: transparent;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.tip-chip:hover {
  border-style: solid;
  background: var(--paper-deep);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.form-actions .btn {
  min-width: 190px;
}

.action-hint {
  font-size: 11.5px;
  color: var(--ink-faint);
  max-width: 320px;
}

.side-card {
  position: sticky;
  top: 88px;
  padding: 20px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: var(--paper-deep);
  box-shadow: var(--shadow-sm);
}

.side-card h3 {
  font-size: 15px;
  margin-bottom: 10px;
}

.side-card ul {
  list-style: none;
  display: grid;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-soft);
}

.side-card li {
  position: relative;
  padding-left: 16px;
}

.side-card li::before {
  content: "•";
  position: absolute;
  left: 2px;
  color: var(--coral);
  font-weight: 900;
}

.side-meta {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1.5px dashed rgba(27, 23, 20, 0.2);
  font-size: 11px;
  color: var(--ink-faint);
  display: grid;
  gap: 4px;
}

/* ------------------------------- result ------------------------------- */
.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.result-title {
  min-width: 0;
}

.result-title h1 {
  font-size: clamp(23px, 3vw, 32px);
  overflow-wrap: anywhere;
}

.result-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin-top: 9px;
  font-size: 11.5px;
  color: var(--ink-faint);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-actions .btn {
  padding: 7px 13px;
  font-size: 12px;
  box-shadow: 0 3px 0 var(--line);
}

.progress-bar {
  position: relative;
  height: 9px;
  margin: 0 0 22px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  overflow: hidden;
}

.progress-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 35%;
  border-radius: 999px;
  background: repeating-linear-gradient(45deg, var(--coral), var(--coral) 10px, var(--sun) 10px, var(--sun) 20px);
  animation: slide 1.4s linear infinite;
}

@keyframes slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(320%); }
}

.doc-panel {
  padding: clamp(20px, 3vw, 38px);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
  min-height: 220px;
}

.doc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 20px;
  border-bottom: 2px solid rgba(27, 23, 20, 0.12);
  font-size: 11.5px;
  color: var(--ink-faint);
}

.doc-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
}

.doc-placeholder {
  display: grid;
  gap: 12px;
  padding: 10px 0 20px;
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--paper-deep) 25%, #fffaf1 50%, var(--paper-deep) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.skeleton-line:nth-child(2) { width: 92%; }
.skeleton-line:nth-child(3) { width: 78%; }
.skeleton-line:nth-child(4) { width: 86%; }
.skeleton-line:nth-child(5) { width: 60%; }

@keyframes shimmer {
  to { background-position: -200% 0; }
}

.error-panel {
  padding: 26px;
  border: 2px solid var(--coral);
  border-radius: 16px;
  background: var(--coral-soft);
}

.error-panel h3 {
  font-size: 18px;
  margin-bottom: 6px;
}

.error-panel p {
  font-size: 13px;
  color: #8b2f14;
  margin-bottom: 14px;
}

.cover-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  padding: 20px;
  margin-bottom: 22px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: var(--mint-soft);
}

.cover-panel h3 {
  font-size: 17px;
  margin-bottom: 6px;
}

.cover-panel p {
  font-size: 12px;
  color: var(--ink-soft);
}

.cover-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.cover-form textarea {
  min-height: 74px;
  font-size: 12.5px;
  background: rgba(255, 255, 255, 0.8);
}

.cover-form .btn {
  justify-self: start;
}

.cover-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cover-gallery {
  display: grid;
  gap: 10px;
  align-content: start;
}

.cover-thumb {
  position: relative;
  border: 2px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.cover-thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.cover-thumb a {
  display: block;
  padding: 6px 9px;
  border-top: 2px solid var(--line);
  font-size: 10.5px;
  font-weight: 800;
  text-align: center;
  background: var(--white);
}

.cover-empty {
  padding: 24px 14px;
  border: 2px dashed rgba(27, 23, 20, 0.28);
  border-radius: 12px;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-faint);
  background: rgba(255, 255, 255, 0.5);
}

.image-state {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-soft);
}

/* ------------------------------- works ------------------------------- */
.works-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 6px 14px;
  border: 2px solid rgba(27, 23, 20, 0.18);
  border-radius: 999px;
  background: var(--white);
  font-size: 12px;
  font-weight: 700;
}

.filter-chip.is-active {
  background: var(--ink);
  border-color: var(--line);
  color: var(--paper);
}

.works-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.work-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease;
}

.work-card:hover {
  transform: translateY(-2px);
}

.work-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.work-service {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--coral-soft);
}

.work-service.cover {
  background: var(--mint-soft);
}

.work-card h3 {
  font-size: 16px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.work-meta {
  font-size: 11px;
  color: var(--ink-faint);
}

.work-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

.work-actions .btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 11.5px;
  box-shadow: 0 2px 0 var(--line);
}

.work-actions .danger {
  color: var(--coral-deep);
}

/* ------------------------------- responsive ------------------------------- */
@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    display: none;
  }

  .app-top {
    height: 58px;
  }

  .top-status {
    display: none;
  }

  .mobile-logout {
    display: inline-flex;
  }

  .mobile-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 9px 14px;
    background: var(--paper);
    border-bottom: 2px solid var(--line);
    position: sticky;
    top: 58px;
    z-index: 14;
  }

  .mobile-nav a {
    flex-shrink: 0;
    padding: 6px 13px;
    border: 1.5px solid rgba(27, 23, 20, 0.18);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-soft);
    background: var(--white);
  }

  .mobile-nav a.is-active {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--line);
  }

  .form-shell {
    grid-template-columns: 1fr;
  }

  .side-card {
    position: static;
  }

  .cover-panel {
    grid-template-columns: 1fr;
  }

  .works-grid {
    grid-template-columns: 1fr;
  }

  .hello-card {
    grid-template-columns: 1fr;
  }

  .hello-streak {
    justify-self: start;
  }
}

@media (max-width: 620px) {
  .view {
    padding-bottom: 48px;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .form-grid.two,
  .mode-grid,
  .char-grid {
    grid-template-columns: 1fr;
  }

  .mode-grid {
    gap: 8px;
  }

  .tiles {
    grid-template-columns: 1fr;
  }

  .result-head {
    flex-direction: column;
  }

  .result-actions {
    width: 100%;
  }

  .result-actions .btn {
    flex: 1;
  }

  .form-actions .btn {
    width: 100%;
  }

  .action-hint {
    max-width: 100%;
  }

  .recent-item {
    align-items: flex-start;
  }

  .status-pill {
    margin-left: auto;
  }
}

/* ---------------------------- stepper & review ---------------------------- */
.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.step-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  padding: 7px 12px 7px 8px;
  border: 1.5px solid rgba(27, 23, 20, 0.2);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: 0.18s ease;
}

.step-label b {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--paper-deep);
  font-size: 10.5px;
}

.step-label.is-active {
  border-color: var(--ink);
  background: var(--coral);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}

.step-label.is-active b {
  background: var(--ink);
  color: var(--white);
}

.step-label.is-done {
  border-color: #1d7a5c;
  background: #e2f6ee;
  color: #155f45;
}

.step-label.is-done b {
  background: #1d7a5c;
  color: var(--white);
}

.step-line {
  flex: 1;
  min-width: 14px;
  height: 2px;
  background: rgba(27, 23, 20, 0.16);
  border-radius: 2px;
}

.step-panel {
  display: none;
}

.step-panel.is-active {
  display: block;
  animation: step-in 0.26s ease both;
}

@keyframes step-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-actions {
  align-items: center;
}

.review-gate {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding: 20px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: #fff6e0;
  box-shadow: 4px 4px 0 var(--ink);
}

.review-gate.is-rejected {
  background: #ffe9e0;
}

.review-gate-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--sun);
  font-size: 20px;
  font-weight: 900;
}

.review-gate h2 {
  margin: 4px 0 6px;
  font-size: 20px;
}

.review-gate p {
  margin: 0 0 6px;
  max-width: 58ch;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}

.review-gate .review-gate-hint {
  font-size: 11px;
  color: var(--ink-faint);
}

.review-gate .btn {
  margin-left: auto;
  flex-shrink: 0;
  align-self: center;
}

.tile-link.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

/* ------------------------------ api pipeline ------------------------------ */
.pipeline {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin: 4px 0 16px;
}

.pipe-step {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  box-shadow: 2px 2px 0 rgba(27, 23, 20, 0.7);
}

.pipe-step > b {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--paper-deep);
  font-size: 12px;
}

.pipe-step.is-active {
  border-color: var(--coral-deep);
  background: #fff8ef;
}

.pipe-step strong {
  display: block;
  font-size: 12.5px;
}

.pipe-step span {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--ink-faint);
}

.pipe-step .status-pill {
  margin-left: auto;
  flex-shrink: 0;
}

.pipe-arrow {
  align-self: center;
  font-style: normal;
  font-size: 18px;
  color: var(--ink-faint);
}

.prompt-preview {
  margin-top: 12px;
  border: 1.5px dashed rgba(27, 23, 20, 0.24);
  border-radius: 10px;
  background: var(--paper);
}

.prompt-preview summary {
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-soft);
  cursor: pointer;
}

.prompt-preview pre {
  margin: 0;
  padding: 0 12px 12px;
  max-height: 180px;
  overflow: auto;
  font-family: var(--font-body);
  font-size: 11.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--ink-soft);
}

@media (max-width: 640px) {
  .step-label span {
    display: none;
  }
  .review-gate {
    flex-direction: column;
  }
  .review-gate .btn {
    margin-left: 0;
    align-self: flex-start;
  }
  .pipeline {
    flex-direction: column;
  }
  .pipe-arrow {
    transform: rotate(90deg);
    align-self: flex-start;
    margin-left: 18px;
  }
}

/* ------------------------- 策划双分页 / 文件面板 / md 查看器 ------------------------- */

.mode-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
  flex-wrap: wrap;
}

.mode-tab {
  padding: 9px 18px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-faint);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
  transition: color 0.15s ease, background 0.15s ease;
}

.mode-tab:hover {
  color: var(--ink);
}

.mode-tab.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

.files-panel {
  margin-top: 22px;
  padding: clamp(18px, 2.4vw, 28px);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

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

.files-head h3 {
  margin: 0;
  font-size: 15px;
}

.file-list {
  display: grid;
  gap: 9px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid rgba(27, 23, 20, 0.14);
  border-radius: 10px;
  background: var(--paper);
}

.file-icon {
  flex: none;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--white);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  font-size: 13px;
}

.file-size {
  flex: none;
  font-size: 11px;
  color: var(--ink-faint);
}

.file-item .btn {
  flex: none;
}

.doc-viewer {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(27, 23, 20, 0.55);
}

.doc-viewer-card {
  display: flex;
  flex-direction: column;
  width: min(880px, 100%);
  max-height: min(86vh, 900px);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.doc-viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 2px solid rgba(27, 23, 20, 0.12);
  background: var(--paper);
}

.doc-viewer-head strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-viewer-tools {
  display: flex;
  gap: 6px;
  flex: none;
}

.doc-viewer-body {
  flex: 1;
  overflow-y: auto;
  padding: clamp(18px, 3vw, 30px);
}

.doc-viewer-content {
  font-size: 14px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.doc-viewer-raw {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* 内嵌 HTML 文件的沙箱 iframe 预览（弹层查看器 + 正文文件分页共用） */
.doc-viewer-frame {
  width: 100%;
  height: min(72vh, 720px);
  border: 1px solid #e3e0d8;
  border-radius: 10px;
  background: #fff;
  display: block;
}

/* ------------------------- 正文多文件分页 / mermaid 架构图 ------------------------- */

.doc-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 4px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1.5px dashed rgba(27, 23, 20, 0.18);
}

.doc-tab {
  padding: 7px 14px;
  border: 1.5px solid rgba(27, 23, 20, 0.22);
  border-radius: 999px;
  background: var(--paper);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.doc-tab:hover {
  color: var(--ink);
}

.doc-tab.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

.md-file-marker {
  margin: 14px 0 10px;
  padding: 6px 12px;
  border-left: 3px solid var(--ink);
  background: rgba(27, 23, 20, 0.06);
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-faint);
}

.mermaid-figure {
  margin: 18px 0;
  padding: 14px;
  border: 1.5px solid rgba(27, 23, 20, 0.14);
  border-radius: 10px;
  background: var(--white);
  overflow-x: auto;
  text-align: center;
}

.mermaid-figure svg {
  max-width: 100%;
  height: auto;
}

.mermaid-note-error {
  color: #a33a2a;
}
