:root {
  color-scheme: light;
  --md-sys-color-primary: #6750a4;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #eaddff;
  --md-sys-color-on-primary-container: #21005d;
  --md-sys-color-secondary-container: #e8def8;
  --md-sys-color-on-secondary-container: #1d192b;
  --md-sys-color-tertiary: #7d5260;
  --md-sys-color-surface: #fffbfe;
  --md-sys-color-surface-container-low: #f7f2fa;
  --md-sys-color-surface-container: #f3edf7;
  --md-sys-color-surface-container-high: #ece6f0;
  --md-sys-color-surface-variant: #e7e0ec;
  --md-sys-color-on-surface: #1d1b20;
  --md-sys-color-on-surface-variant: #49454f;
  --md-sys-color-outline: #79747e;
  --md-sys-color-outline-variant: #cac4d0;
  --md-sys-color-success: #386a20;
  --md-sys-color-success-container: #b8f397;
  --md-sys-color-warning: #7c5800;
  --md-sys-color-warning-container: #ffdea1;
  --md-sys-color-info: #005ac1;
  --md-sys-elevation-1: 0 1px 2px rgba(0, 0, 0, .18), 0 1px 3px rgba(0, 0, 0, .12);
  --md-sys-elevation-2: 0 2px 6px rgba(0, 0, 0, .16), 0 1px 2px rgba(0, 0, 0, .14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-family: "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

button, input, textarea, select { font: inherit; }
h1, h2, h3, p { margin: 0; }

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(420px, 1fr) minmax(380px, 540px);
  min-height: 100vh;
}

.sidebar {
  background: var(--md-sys-color-surface-container-low);
  border-right: 1px solid var(--md-sys-color-outline-variant);
  padding: 24px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  padding: 0 6px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font-size: 22px;
  font-weight: 700;
  box-shadow: var(--md-sys-elevation-1);
}

.brand h1 {
  font-size: 18px;
  line-height: 1.25;
}

.brand p,
.topbar p,
.storage-panel p,
.storage-panel small {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 13px;
  line-height: 1.5;
}

.filters {
  display: grid;
  gap: 8px;
}

.filter,
.icon-button,
.tonal-button,
.primary,
.ghost,
select {
  border: 0;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
}

.filter {
  min-height: 48px;
  border-radius: 24px;
  padding: 0 18px;
  background: transparent;
  text-align: left;
  color: var(--md-sys-color-on-surface-variant);
}

.filter:hover {
  background: var(--md-sys-color-surface-container-high);
}

.filter.active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-weight: 700;
}

.legend,
.storage-panel {
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 24px;
  box-shadow: var(--md-sys-elevation-1);
}

.legend {
  display: grid;
  gap: 10px;
  margin-top: 24px;
  padding: 16px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 13px;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
}

.dot.todo { background: var(--md-sys-color-outline); }
.dot.active { background: var(--md-sys-color-warning); }
.dot.done { background: var(--md-sys-color-success); }

.storage-panel {
  margin-top: 16px;
  padding: 18px;
}

.storage-panel h2 {
  font-size: 15px;
  margin-bottom: 4px;
}

.storage-meter {
  height: 8px;
  margin: 14px 0 8px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--md-sys-color-surface-variant);
}

.storage-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--md-sys-color-primary);
}

.main {
  min-width: 0;
  padding: 28px;
  background: var(--md-sys-color-surface);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h2 {
  font-size: 28px;
  line-height: 1.2;
}

.top-actions,
.row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  background: var(--md-sys-color-surface-container);
  font-size: 20px;
}

.tonal-button,
.primary,
.ghost {
  min-height: 40px;
  border-radius: 20px;
  padding: 0 18px;
  font-weight: 700;
}

.tonal-button,
.ghost {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.primary {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.board {
  display: grid;
  gap: 14px;
}

.task-card {
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--md-sys-elevation-1);
  cursor: pointer;
  transition: background .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.task-card:hover {
  background: var(--md-sys-color-surface-container);
  box-shadow: var(--md-sys-elevation-2);
}

.task-card.selected {
  border-color: var(--md-sys-color-primary);
  background: var(--md-sys-color-primary-container);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.task-id {
  font-size: 16px;
  font-weight: 800;
}

.status-pill,
.source-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 14px;
  padding: 0 10px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.published,
.status-pill.ready {
  background: var(--md-sys-color-success-container);
  color: var(--md-sys-color-success);
}

.status-pill.progress {
  background: var(--md-sys-color-warning-container);
  color: var(--md-sys-color-warning);
}

.task-title {
  margin-top: 10px;
  font-size: 16px;
  font-weight: 700;
}

.task-meta {
  margin-top: 6px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 13px;
  line-height: 1.55;
}

.card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin-top: 14px;
}

.step {
  height: 8px;
  border-radius: 99px;
  background: var(--md-sys-color-surface-variant);
}

.step.done { background: var(--md-sys-color-success); }
.step.active { background: var(--md-sys-color-warning); }

.detail {
  overflow: auto;
  padding: 28px;
  background: var(--md-sys-color-surface-container-low);
  border-left: 1px solid var(--md-sys-color-outline-variant);
}

.empty-state {
  padding: 32px;
  border-radius: 28px;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface-variant);
}

.detail h2 {
  font-size: 24px;
  line-height: 1.25;
  margin-bottom: 6px;
}

.detail-section {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 24px;
  background: var(--md-sys-color-surface);
  box-shadow: var(--md-sys-elevation-1);
}

.detail-section h3 {
  margin-bottom: 12px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 13px;
  letter-spacing: 0;
}

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

.media-box {
  min-height: 160px;
  overflow: hidden;
  border-radius: 18px;
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.media-box img,
.media-box video {
  width: 100%;
  display: block;
  background: var(--md-sys-color-surface-variant);
}

.media-label {
  padding: 10px 12px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 12px;
  font-weight: 700;
}

.path {
  overflow-wrap: anywhere;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 12px;
  line-height: 1.6;
}

.prompt-box {
  width: 100%;
  min-height: 122px;
  resize: vertical;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 18px;
  padding: 14px;
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface);
  line-height: 1.6;
}

select {
  min-height: 40px;
  border-radius: 20px;
  padding: 0 14px;
  background: var(--md-sys-color-surface-container);
}

.kv {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 13px;
  line-height: 1.5;
}

.kv + .kv { margin-top: 8px; }
.kv strong { color: var(--md-sys-color-on-surface); font-weight: 700; }

@media (max-width: 1160px) {
  .app-shell { grid-template-columns: 240px 1fr; }
  .detail {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--md-sys-color-outline-variant);
  }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar, .main, .detail { padding: 16px; }
  .topbar { align-items: flex-start; }
  .topbar h2 { font-size: 24px; }
  .media-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
