:root {
  --paper: #f4ead7;
  --paper-strong: #fbf7ef;
  --ink: #1b1713;
  --muted: #6b6157;
  --line: rgba(64, 48, 28, 0.12);
  --accent: #986740;
  --accent-strong: #77431a;
  --accent-cool: #245d66;
  --danger: #a23535;
  --success: #2d6a4f;
  --warning: #9b6b16;
  --card: rgba(255, 251, 245, 0.84);
  --card-strong: rgba(255, 255, 255, 0.88);
  --shadow: 0 18px 50px rgba(74, 51, 26, 0.12);
  --radius: 22px;
  --mono: "JetBrains Mono", "SFMono-Regular", monospace;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --serif: "Noto Serif SC", "Source Han Serif SC", "PingFang SC", serif;
  --top-title-height: 52px;
  --header-height: 136px;
  }

  * {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background: linear-gradient(180deg, #f8f4ec 0%, #efe2cd 100%);
}

.background-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at top left, rgba(152, 103, 64, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(36, 93, 102, 0.12), transparent 24%);
}

.hidden {
  display: none !important;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-cool);
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: var(--mono);
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(61, 45, 30, 0.18);
  background: rgba(255, 255, 255, 0.85);
  padding: 12px 14px;
  color: var(--ink);
}

input:disabled {
  background: rgba(231, 224, 214, 0.7);
}

textarea {
  resize: vertical;
  min-height: 128px;
}

label {
  display: grid;
  gap: 8px;
}

label span {
  font-size: 14px;
}

button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.primary {
  background: linear-gradient(135deg, var(--accent), #c08b58);
  color: #fff8f0;
}

.secondary {
  background: rgba(36, 93, 102, 0.12);
  color: var(--accent-cool);
}

.ghost {
  background: rgba(35, 27, 20, 0.08);
  color: var(--ink);
}

.link-button {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 600;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  max-width: min(42vw, 360px);
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(36, 93, 102, 0.1);
  color: var(--accent-cool);
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.auth-card {
  width: min(440px, 100%);
  padding: 32px;
  border-radius: 28px;
  background: var(--card-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.stack-form {
  display: grid;
  gap: 16px;
}

.auth-switch {
  display: flex;
  gap: 10px;
  margin: 18px 0;
}

.auth-tab {
  flex: 1;
}

.auth-tab.is-active {
  background: var(--ink);
  color: #f7efe4;
}

.rule-box {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(36, 93, 102, 0.08);
  border: 1px solid rgba(36, 93, 102, 0.14);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.rule-box strong {
  color: var(--accent-cool);
}

.status-hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  padding: 24px;
}

.sidebar {
  display: grid;
  gap: 18px;
  align-content: start;
}

.brand {
  height: var(--header-height) !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
}

.brand,
.profile-card,
.nav-menu,
.topbar,
.section-card {
  padding: 22px;
}

.profile-card h2 {
  margin-bottom: 6px;
}

.quota-boxes {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.quota-box {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
}

.quota-box span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.nav-menu {
  display: grid;
  gap: 10px;
}

.shortcut-item {
  font-size: 14px;
}

.nav-item {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
}

.nav-item.is-active {
  background: var(--ink);
  color: #f7efe4;
}

.main-shell {
  display: grid;
  gap: 20px;
  align-content: start;
}

.topbar {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  height: var(--header-height) !important;
  min-height: var(--header-height) !important;
  max-height: var(--header-height) !important;
  padding: 0 24px !important;
  gap: 24px;
}

/* 隐藏顶部栏里多余的小标题，确保主标题对齐 */
.topbar .eyebrow {
  display: none !important;
}

.top-menu {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  height: 100%;
  flex: 1;
}

.top-nav-item {
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 110px !important;
  height: 42px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid transparent !important;
  border-radius: 12px !important;
  
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  user-select: none !important;
  
  background: rgba(35, 27, 20, 0.05);
  color: var(--muted);
  transition: all 140ms ease !important;
}

.top-nav-item:hover {
  background: rgba(35, 27, 20, 0.1) !important;
  color: var(--ink) !important;
}

.top-nav-item.is-active {
  background: var(--accent-strong) !important;
  color: #fff8f0 !important;
  box-shadow: 0 4px 12px rgba(121, 67, 26, 0.15) !important;
}

.topbar > div:first-child {
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  margin: 0 !important;
}

#view-title {
  height: auto !important;
  line-height: 1 !important;
  margin: 0 !important;
  font-size: 20px !important;
  white-space: nowrap;
}

.topbar-side {
  height: 100% !important;
  display: flex !important;
  gap: 12px;
  flex-wrap: nowrap;
  align-items: center !important;
  justify-content: flex-end;
}

.view-panel {
  display: grid;
  gap: 20px;
}

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

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h3 {
  margin-bottom: 0;
  font-family: var(--serif);
  font-size: 24px;
}

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

.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.toggle-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox input {
  width: auto;
}

.progress-panel {
  display: grid;
  gap: 14px;
}

.progress-bar {
  height: 12px;
  border-radius: 999px;
  background: rgba(51, 37, 21, 0.08);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #d8aa76);
  transition: width 200ms ease;
}

.progress-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.progress-step {
  min-height: 58px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
}

.progress-step.is-active {
  color: var(--ink);
  border-color: rgba(152, 103, 64, 0.3);
}

.progress-step.is-success {
  color: var(--success);
  border-color: rgba(45, 106, 79, 0.3);
}

.progress-step.is-error {
  color: var(--danger);
  border-color: rgba(162, 53, 53, 0.26);
}

.upload-preview {
  min-height: 120px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(80, 60, 36, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.42);
  overflow: hidden;
}

.upload-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  display: block;
}

.result-grid {
  display: grid;
  gap: 16px;
}

.result-grid.cols-1 {
  grid-template-columns: 1fr;
}

.result-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.result-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-grid.cols-4 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-card,
.placeholder-card {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.result-card img,
.placeholder-card .placeholder-image {
  width: 100%;
  object-fit: contain;
  display: block;
  background: rgba(248, 244, 236, 0.82);
}

.result-card img {
  height: auto;
  max-height: 460px;
}

.placeholder-card .placeholder-image {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  padding: 18px;
  background: linear-gradient(90deg, rgba(235, 225, 213, 0.72), rgba(248, 244, 236, 0.9), rgba(235, 225, 213, 0.72));
  background-size: 240% 100%;
  animation: shimmer 1.4s linear infinite;
}

.placeholder-card .placeholder-image.is-error {
  animation: none;
  background: rgba(162, 53, 53, 0.08);
}

.placeholder-card .placeholder-meta {
  padding: 14px;
  display: grid;
  gap: 8px;
}

.slot-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(36, 93, 102, 0.12);
  color: var(--accent-cool);
  font-size: 12px;
  font-weight: 600;
}

.placeholder-line {
  height: 12px;
  border-radius: 999px;
  background: rgba(64, 48, 28, 0.08);
}

.placeholder-line.short {
  width: 52%;
}

.result-meta {
  padding: 14px;
  display: grid;
  gap: 10px;
}

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

.result-grid.cols-1 .result-card img {
  max-height: 520px;
}

.result-grid.cols-2 .result-card img {
  max-height: 380px;
}

.result-grid.cols-3 .result-card img,
.result-grid.cols-4 .result-card img {
  max-height: 280px;
}

.mini-button {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(152, 103, 64, 0.1);
  color: var(--accent-strong);
  border: none;
  cursor: pointer;
}

.table-shell {
  display: grid;
  gap: 10px;
}

.table-row {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
}

.table-row header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.table-row h4 {
  margin-bottom: 4px;
}

.table-row .meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 13px;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(36, 93, 102, 0.12);
  color: var(--accent-cool);
  font-size: 12px;
}

.pill.warn {
  background: rgba(155, 107, 22, 0.14);
  color: var(--warning);
}

.pill.danger {
  background: rgba(162, 53, 53, 0.12);
  color: var(--danger);
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.permission-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
}

.card-list {
  display: grid;
  gap: 12px;
}

.status-list {
  display: grid;
  gap: 12px;
}

.status-list.compact {
  margin-top: 18px;
}

.status-item {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
}

.status-item strong {
  display: block;
  margin-bottom: 4px;
}

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

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

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

  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .top-menu {
    width: 100%;
  }

  .topbar-side {
    justify-self: start;
    width: 100%;
    overflow-x: auto;
  }
}



@media (max-width: 720px) {
  .app-shell {
    padding: 16px;
  }

  .brand,
  .profile-card,
  .nav-menu,
  .topbar,
  .section-card {
    padding: 18px;
  }

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

  .result-grid.cols-2,
  .result-grid.cols-3,
  .result-grid.cols-4 {
    grid-template-columns: 1fr;
  }
}
