:root {
  color-scheme: light;

  /* Brand */
  --brand-600: #c6503b;
  --brand-700: #b94734;
  --brand-soft: #fff0eb;
  --brand-decorative: #d9624b;
  --gold-500: #d7b86a;
  --gold-soft: #f7efd7;

  /* Text and surfaces */
  --ink-950: #202a26;
  --ink-800: #34413b;
  --ink-600: #4f5853;
  --ink-500: #68716c;
  --ink-disabled: #8a918d;
  --canvas: #f6f4ef;
  --surface-1: #ffffff;
  --surface-2: #fbfaf7;
  --surface-3: #f0ede6;
  --line-soft: #ebe8e1;
  --line-default: #dedad1;
  --line-strong: #c9c3b8;

  /* Shell */
  --sidebar: #23352f;
  --sidebar-deep: #1b2b26;
  --sidebar-text: #e8eee9;
  --sidebar-muted: #9fafa6;

  /* Semantic */
  --success: #3f7a57;
  --success-bg: #eaf4ed;
  --warning: #9a6413;
  --warning-bg: #fff5dd;
  --danger: #b94c3d;
  --danger-bg: #fcece8;
  --info: #356a83;
  --info-bg: #eaf3f7;
  --neutral-status: #68716c;
  --neutral-status-bg: #f0f1ef;

  /* Studio */
  --studio-canvas: #111614;
  --studio-surface: #1a211e;
  --studio-line: #303a35;
  --studio-text: #f2f5f3;
  --studio-muted: #a8b2ac;

  /* Typography */
  --font-ui: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-display: "Songti SC", "STSong", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-11: 11px;
  --text-12: 12px;
  --text-13: 13px;
  --text-14: 14px;
  --text-16: 16px;
  --text-18: 18px;
  --text-20: 20px;
  --text-24: 24px;
  --text-32: 32px;

  /* Spacing and shape */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;
  --shadow-popover: 0 12px 32px rgba(25, 35, 30, 0.14);
  --shadow-modal: 0 24px 70px rgba(12, 18, 15, 0.28);
  --focus-ring: rgba(53, 106, 131, 0.28);
  --overlay: rgba(12, 18, 15, 0.78);

  /* Compatibility aliases for existing modules */
  --ink: var(--ink-950);
  --paper: var(--canvas);
  --card: var(--surface-1);
  --line: var(--line-default);
  --soft-line: var(--line-soft);
  --muted: var(--ink-500);
  --green: var(--success);
  --forest: var(--sidebar);
  --coral: var(--brand-600);
  --soft: var(--surface-3);
  --focus: var(--info);
  --primary-soft: var(--brand-soft);
  --yellow: var(--gold-500);
  --yellow-deep: #a88232;
  --sidebar-2: var(--sidebar-deep);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--canvas);
  color: var(--ink-950);
  font-family: var(--font-ui);
  font-size: var(--text-14);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

button,
a,
input,
textarea,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}

button {
  min-height: 40px;
  padding: 0 var(--space-4);
  border: 1px solid var(--line-default);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--ink-800);
  font-size: var(--text-13);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

button:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.primary {
  border-color: var(--brand-600);
  background: var(--brand-600);
  color: #ffffff;
}

button.primary:hover {
  border-color: var(--brand-700);
  background: var(--brand-700);
}

button.soft {
  border-color: var(--line-default);
  background: var(--surface-3);
  color: var(--ink-800);
}

button.soft:hover {
  border-color: var(--line-strong);
  background: #e8e4dc;
}

button.wide {
  width: 100%;
  min-height: 44px;
  margin-top: var(--space-2);
}

a {
  color: var(--info);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  padding: 9px var(--space-3);
  border: 1px solid var(--line-default);
  border-radius: var(--radius-sm);
  outline: 0;
  background: var(--surface-1);
  color: var(--ink-950);
  font-size: var(--text-13);
  line-height: 1.45;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--line-strong);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--info);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

input:disabled,
textarea:disabled,
select:disabled {
  background: var(--surface-3);
  color: var(--ink-disabled);
  cursor: not-allowed;
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-disabled);
}

textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.65;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-3);
  color: var(--ink-600);
  font-size: var(--text-13);
  font-weight: 650;
}

code,
pre {
  font-family: var(--font-mono);
}

code {
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  color: var(--ink-800);
  font-size: 0.9em;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.hidden {
  display: none !important;
}

.eyebrow {
  display: inline-block;
  color: var(--ink-500);
  font-size: var(--text-11);
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.4;
  text-transform: uppercase;
}

.coral {
  color: var(--brand-600);
}

.pill,
.status,
.account-status,
.system-role-badge,
.readiness-badge,
.automation-mark {
  display: inline-flex;
  width: max-content;
  min-height: 24px;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background: var(--neutral-status-bg);
  color: var(--neutral-status);
  font-size: var(--text-11);
  font-weight: 750;
  line-height: 1.4;
  white-space: nowrap;
}

.status.success,
.pill.success {
  background: var(--success-bg);
  color: var(--success);
}

.status.warning,
.pill.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.status.danger,
.pill.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.status.info,
.pill.info {
  background: var(--info-bg);
  color: var(--info);
}

.card,
.empty,
.list > article {
  margin-bottom: var(--space-4);
  border: 1px solid var(--line-default);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}

.pad {
  padding: var(--space-5);
}

.compact summary {
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  font-weight: 750;
}

.empty {
  min-height: 240px;
  display: grid;
  place-items: center;
  padding: var(--space-8);
  color: var(--ink-500);
  text-align: center;
}

.compact-empty {
  min-height: 112px;
}

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

.step {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-align: left;
}

.step i {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-style: normal;
}

.step span {
  min-width: 0;
  font-weight: 700;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line-default);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}

.stats > div {
  min-width: 0;
  padding: var(--space-4);
  border-right: 1px solid var(--line-soft);
}

.stats > div:last-child {
  border-right: 0;
}

.stats b,
.stats span {
  display: block;
}

.stats b {
  color: var(--ink-950);
  font-size: 28px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stats span {
  margin-top: 4px;
  color: var(--ink-500);
  font-size: var(--text-12);
}

.layout,
.workspace {
  min-width: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: view-in 180ms ease-out;
}

.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.section-title h3 {
  margin: 4px 0 0;
  color: var(--ink-950);
  font-size: var(--text-24);
  line-height: 1.3;
}

.section-title p {
  margin: 4px 0 0;
  color: var(--ink-500);
  font-size: var(--text-13);
}

.grid2,
.grid3 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

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

.span2,
.span3 {
  grid-column: 1 / -1;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.grow {
  flex: 1;
}

.vertical {
  min-width: 190px;
  flex-direction: column;
}

.align-end {
  align-self: end;
  margin-bottom: var(--space-3);
}

.task-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.task-head b {
  font-size: var(--text-16);
}

.folder-list,
.package-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-3);
}

.folder-list span,
.package-links span {
  padding: 4px 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--ink-600);
  font-size: var(--text-11);
}

.asset-card,
.action-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-5);
}

.studio-surface {
  border-color: var(--studio-line);
  background: var(--studio-canvas);
  color: var(--studio-text);
}

@keyframes view-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 900px) {
  .grid2,
  .grid3 {
    grid-template-columns: 1fr;
  }

  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .asset-card,
  .action-card {
    align-items: stretch;
    flex-direction: column;
  }

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

  .stats > div:nth-child(2) {
    border-right: 0;
  }

  .stats > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line-soft);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
