@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --ink: #202226;
  --ink-soft: #666a72;
  --muted: #8d9198;
  --paper: #f6f5f0;
  --panel: #ffffff;
  --line: #e7e5df;
  --line-strong: #d9d6ce;
  --accent: #ee6a4e;
  --accent-deep: #cc523a;
  --accent-pale: #fff0eb;
  --sage: #477c68;
  --sage-pale: #eaf4ee;
  --shadow: 0 16px 34px rgba(35, 36, 38, 0.07);
  --radius: 12px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: 'DM Sans', 'Microsoft YaHei', sans-serif; font-size: 15px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 248px; min-height: 100vh; padding: 27px 16px 20px; border-right: 1px solid var(--line); background: #faf9f6; display: flex; flex-direction: column; gap: 32px; position: sticky; top: 0; align-self: flex-start; }
.brand { padding: 0 13px; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 28px; height: 28px; display: grid; place-items: center; background: var(--ink); color: #fff; border-radius: 8px; font-family: 'Space Grotesk'; font-weight: 700; font-size: 13px; letter-spacing: -0.08em; }
.brand-name { font-family: 'Space Grotesk'; font-size: 16px; font-weight: 700; letter-spacing: -0.03em; }
.brand-sub { color: var(--muted); font-size: 10px; margin-left: auto; letter-spacing: .04em; }
.nav-label { padding: 0 13px 9px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .13em; }
.nav-list { display: grid; gap: 3px; }
.nav-item { border: 0; background: transparent; width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 13px; color: var(--ink-soft); border-radius: 8px; font-size: 13px; text-align: left; transition: .18s ease; }
.nav-item:hover { color: var(--ink); background: #f0eee9; }
.nav-item.active { color: var(--ink); background: #edeae3; font-weight: 600; }
.nav-icon { width: 18px; color: var(--muted); text-align: center; font-size: 15px; }
.nav-item.active .nav-icon { color: var(--accent); }
.sidebar-spacer { flex: 1; }
.upgrade-box { margin: 0 5px; padding: 14px; background: #efede6; border-radius: 10px; }
.upgrade-box p { margin: 0 0 10px; font-size: 12px; line-height: 1.45; color: var(--ink-soft); }
.upgrade-box strong { display: block; font-size: 12px; margin-bottom: 5px; }
.upgrade-box button { border: 0; background: var(--ink); color: #fff; font-size: 11px; padding: 7px 10px; border-radius: 6px; }
.profile { display: flex; gap: 9px; align-items: center; padding: 0 10px; }
.avatar { width: 29px; height: 29px; border-radius: 50%; background: #d8d0c4; display: grid; place-items: center; color: #63594e; font-size: 11px; font-weight: 700; }
.profile-info { min-width: 0; }
.profile-info strong { display: block; font-size: 12px; }
.profile-info span { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }

.main { flex: 1; min-width: 0; }
.topbar { height: 72px; padding: 0 42px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: rgba(246,245,240,.88); }
.breadcrumb { color: var(--muted); font-size: 12px; }
.breadcrumb strong { color: var(--ink); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-button { width: 32px; height: 32px; border: 1px solid var(--line); background: #fff; color: var(--ink-soft); border-radius: 7px; display: grid; place-items: center; font-size: 14px; }
.icon-button:hover { border-color: var(--line-strong); color: var(--ink); }
.main-content { max-width: 1500px; margin: 0 auto; padding: 38px 42px 62px; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .13em; font-size: 10px; font-weight: 700; margin-bottom: 10px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-family: 'Space Grotesk'; letter-spacing: -0.045em; font-size: clamp(29px, 3vw, 44px); line-height: 1.04; margin-bottom: 14px; }
h2 { font-family: 'Space Grotesk'; letter-spacing: -0.035em; font-size: 24px; margin-bottom: 8px; }
h3 { font-size: 15px; margin-bottom: 6px; }
.lede { color: var(--ink-soft); line-height: 1.65; max-width: 585px; font-size: 14px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 31px; gap: 20px; }
.page-header .lede { margin-bottom: 0; }
.header-actions { display: flex; gap: 9px; flex-shrink: 0; }
.btn { border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; color: var(--ink); padding: 10px 14px; font-size: 12px; font-weight: 600; transition: .18s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 13px rgba(35,36,38,.07); }
.btn-primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-deep); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-sm { padding: 7px 10px; font-size: 11px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 38px; }
.stat-card { padding: 17px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.stat-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; }
.stat-top b { font-size: 11px; color: var(--sage); font-weight: 600; }
.stat-value { font-family: 'Space Grotesk'; font-size: 27px; letter-spacing: -.04em; margin-top: 13px; }
.stat-caption { color: var(--muted); font-size: 11px; margin-top: 3px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.section-heading h2 { font-size: 17px; margin-bottom: 0; }
.text-link { background: none; border: 0; color: var(--accent-deep); font-size: 11px; font-weight: 600; }
.dashboard-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; }
.surface { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.start-card { min-height: 285px; padding: 25px; position: relative; overflow: hidden; background: #232426; color: #fff; border-color: #232426; }
.start-card:after { content: ''; position: absolute; width: 250px; height: 250px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; right: -57px; top: -74px; box-shadow: 0 0 0 30px rgba(255,255,255,.025), 0 0 0 60px rgba(255,255,255,.02); }
.start-card h2 { max-width: 390px; font-size: 25px; line-height: 1.15; margin: 31px 0 10px; }
.start-card p { color: #b5b4b0; max-width: 370px; font-size: 13px; line-height: 1.6; }
.start-card .btn { position: relative; z-index: 1; margin-top: 18px; border-color: #fff; background: #fff; color: var(--ink); }
.start-tag { display: inline-flex; align-items: center; gap: 6px; color: #ddd8d0; font-size: 11px; }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: #f08168; box-shadow: 0 0 0 4px rgba(240,129,104,.13); }
.recent-card { padding: 20px 20px 8px; }
.recent-row { border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 14px 0; }
.recent-row:first-of-type { border-top: 0; }
.task-dot { width: 29px; height: 29px; border-radius: 7px; display: grid; place-items: center; background: var(--accent-pale); color: var(--accent-deep); font-size: 13px; }
.recent-main { flex: 1; min-width: 0; }
.recent-main strong { font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-main span { color: var(--muted); font-size: 10px; display: block; margin-top: 3px; }
.recent-time { color: var(--muted); font-size: 10px; }
.model-strip { margin-top: 34px; }
.model-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.model-card { padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #fff; transition: .18s ease; }
.model-card:hover { border-color: #c9c5bb; transform: translateY(-2px); }
.model-card-top { display: flex; gap: 9px; align-items: center; }
.model-logo { width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 7px; display: grid; place-items: center; font-family: 'Space Grotesk'; font-size: 10px; font-weight: 700; color: var(--accent-deep); }
.model-card strong { font-size: 12px; }
.model-card p { color: var(--muted); font-size: 10px; margin: 11px 0 0; line-height: 1.4; }
.status { display: inline-flex; align-items: center; gap: 5px; color: var(--sage); font-size: 10px; margin-top: 10px; }
.status-dot { width: 5px; height: 5px; background: currentColor; border-radius: 50%; }

.workspace-layout { display: grid; grid-template-columns: 194px minmax(350px, 1fr) minmax(350px, .92fr); gap: 14px; align-items: start; }
.workspace-rail { padding: 13px 8px; background: #f0eee8; border: 1px solid var(--line); border-radius: var(--radius); position: sticky; top: 88px; }
.workspace-rail-label { color: var(--muted); font-size: 10px; padding: 7px 9px 8px; text-transform: uppercase; letter-spacing: .11em; }
.task-nav-btn { width: 100%; border: 0; display: flex; align-items: center; gap: 8px; padding: 8px 9px; background: transparent; color: var(--ink-soft); border-radius: 6px; text-align: left; font-size: 11px; }
.task-nav-btn:hover { background: #e7e4dc; color: var(--ink); }
.task-nav-btn.active { background: #fff; color: var(--ink); box-shadow: 0 2px 7px rgba(25,25,25,.05); font-weight: 600; }
.task-nav-btn span:first-child { width: 16px; font-size: 12px; }
.workspace-column { min-width: 0; }
.work-panel { padding: 20px; margin-bottom: 13px; }
.work-panel-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.work-panel-header h3 { margin-bottom: 3px; font-size: 15px; }
.work-panel-header p { color: var(--muted); font-size: 11px; margin-bottom: 0; }
.field { margin-top: 16px; }
.field label { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 11px; color: var(--ink-soft); font-weight: 600; }
.field label span { color: var(--muted); font-weight: 400; }
textarea, input, select { width: 100%; border: 1px solid var(--line-strong); border-radius: 7px; background: #fbfaf8; color: var(--ink); padding: 10px 11px; outline: none; font-size: 12px; transition: .18s ease; }
textarea:focus, input:focus, select:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(238,106,78,.1); }
textarea { resize: vertical; line-height: 1.6; min-height: 122px; }
.select-wrap { position: relative; }
.select-wrap:after { content: '⌄'; position: absolute; right: 11px; top: 8px; color: var(--muted); pointer-events: none; }
select { appearance: none; padding-right: 29px; }
.model-select-box { display: flex; gap: 9px; align-items: center; padding: 10px 11px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fbfaf8; }
.model-select-box .model-logo { flex: 0 0 27px; }
.model-select-box .select-wrap { flex: 1; }
.model-select-box select { border: 0; padding: 0; background: transparent; }
.model-select-box select:focus { box-shadow: none; }
.parameter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.parameter-grid .field:first-child { grid-column: 1 / -1; }
.help-text { color: var(--muted); font-size: 10px; line-height: 1.45; margin-top: 6px; }
.generate-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.generate-row .btn-primary { flex: 1; }
.shortcut { color: var(--muted); font-size: 10px; }
.output-panel { padding: 0; overflow: hidden; }
.output-head { padding: 19px 20px 15px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.output-title { display: flex; align-items: center; gap: 9px; }
.output-title h3 { margin: 0; }
.output-badge { color: var(--sage); background: var(--sage-pale); border-radius: 4px; font-size: 9px; padding: 4px 6px; font-weight: 700; }
.output-body { padding: 20px; }
.output-placeholder { min-height: 380px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); padding: 20px; }
.placeholder-icon { width: 46px; height: 46px; border: 1px dashed #c7c3ba; border-radius: 12px; display: grid; place-items: center; font-family: 'Space Grotesk'; font-size: 19px; color: #b2ada3; margin-bottom: 14px; }
.output-placeholder p { max-width: 240px; font-size: 11px; line-height: 1.6; }
.result-content { display: none; }
.result-content.visible { display: block; }
.result-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; color: var(--muted); font-size: 10px; }
.result-copy { white-space: pre-wrap; background: #262729; color: #ede9df; border-radius: 8px; padding: 16px; font-family: 'Space Grotesk', monospace; font-size: 12px; line-height: 1.75; min-height: 215px; }
.result-section { margin-top: 18px; }
.result-section-title { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .11em; margin-bottom: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.quality-grid { display: grid; gap: 7px; }
.quality-row { display: grid; grid-template-columns: minmax(76px, 1fr) 34px 2fr; gap: 8px; align-items: center; padding: 8px 9px; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfb; font-size: 11px; }
.quality-row strong { color: var(--accent); font-size: 12px; }
.quality-row small { color: var(--muted); line-height: 1.4; }
.clarification-panel { margin-bottom: 16px; padding: 13px; border: 1px solid #e8d8be; border-radius: 7px; background: #fffaf2; color: var(--ink-soft); }
.clarification-panel strong { font-size: 12px; }
.clarification-panel p { margin: 5px 0 10px; color: var(--muted); font-size: 11px; }
.clarification-item { margin: 9px 0; }
.clarification-item label { display: block; margin-bottom: 5px; font-size: 11px; font-weight: 600; }
.chip { border: 1px solid var(--line); background: #faf9f6; padding: 5px 7px; border-radius: 4px; color: var(--ink-soft); font-size: 10px; }
.warning { color: #93633e; background: #fff8e9; border: 1px solid #f1dfba; padding: 10px; border-radius: 7px; font-size: 10px; line-height: 1.5; }
.output-actions { border-top: 1px solid var(--line); margin: 20px -20px -20px; padding: 12px 20px; display: flex; gap: 7px; }
.output-actions .btn { flex: 1; }
.version-row { display: flex; gap: 6px; margin-top: 13px; }
.version-btn { border: 1px solid var(--line); background: #fff; border-radius: 5px; padding: 6px 8px; font-size: 10px; color: var(--muted); }
.version-btn.active { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-pale); }

.cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.library-toolbar { display: flex; gap: 9px; align-items: center; margin-bottom: 18px; }
.library-toolbar input { max-width: 280px; }
.filter-select { width: 150px; }
.library-card { padding: 18px; min-height: 178px; display: flex; flex-direction: column; }
.library-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.library-card h3 { margin: 0; font-size: 14px; }
.library-card p { margin: 12px 0 17px; color: var(--ink-soft); font-size: 11px; line-height: 1.55; flex: 1; }
.tag-row { display: flex; gap: 5px; flex-wrap: wrap; }
.tag { background: #f0eee8; color: var(--ink-soft); border-radius: 4px; padding: 4px 6px; font-size: 9px; }
.star { background: transparent; border: 0; color: #b9b4aa; font-size: 16px; padding: 0; }
.star.active { color: #e6a546; }
.table-shell { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 14px 16px; font-size: 11px; white-space: nowrap; }
th { color: var(--muted); background: #faf9f6; font-size: 10px; font-weight: 600; }
td { color: var(--ink-soft); }
td strong { color: var(--ink); font-size: 12px; }
tr:last-child td { border-bottom: 0; }
.pill { border-radius: 4px; padding: 4px 6px; font-size: 9px; background: #f0eee8; color: var(--ink-soft); }
.pill.green { background: var(--sage-pale); color: var(--sage); }
.pill.orange { background: var(--accent-pale); color: var(--accent-deep); }
.empty-state { text-align: center; padding: 52px 20px; color: var(--muted); font-size: 12px; }
.settings-layout { display: grid; grid-template-columns: 205px minmax(0, 700px); gap: 28px; }
.settings-nav { display: grid; align-content: start; gap: 3px; }
.settings-tab { padding: 10px 12px; border: 0; background: transparent; text-align: left; color: var(--ink-soft); border-radius: 6px; font-size: 12px; }
.settings-tab.active { color: var(--ink); font-weight: 600; background: #e9e6de; }
.settings-section { margin-bottom: 28px; }
.settings-section h3 { margin-bottom: 4px; }
.settings-section > p { color: var(--muted); font-size: 11px; line-height: 1.5; margin-bottom: 15px; }
.api-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.secret-field { position: relative; }
.secret-field input { padding-right: 40px; }
.reveal { position: absolute; right: 8px; top: 7px; background: transparent; border: 0; color: var(--muted); font-size: 12px; }
.notice { padding: 12px; border-radius: 7px; background: #f0f5f2; border: 1px solid #d9e9df; color: #46705e; font-size: 11px; line-height: 1.5; }
.toast { position: fixed; left: 50%; bottom: 25px; transform: translateX(-50%) translateY(18px); opacity: 0; pointer-events: none; background: #242528; color: #fff; padding: 10px 14px; border-radius: 7px; font-size: 11px; box-shadow: var(--shadow); transition: .25s ease; z-index: 10; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.mobile-toggle { display: none; }

@media (max-width: 1120px) {
  .workspace-layout { grid-template-columns: 160px minmax(300px, 1fr); }
  .workspace-layout .output-column { grid-column: 2; }
  .model-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .sidebar { width: 205px; }
  .topbar { padding: 0 22px; }
  .main-content { padding: 28px 22px 45px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-layout { grid-template-columns: 1fr; gap: 18px; }
  .settings-nav { display: flex; overflow-x: auto; }
  .settings-tab { white-space: nowrap; }
}
@media (max-width: 640px) {
  .sidebar { position: fixed; z-index: 5; left: 0; top: 0; transform: translateX(-100%); transition: .22s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .mobile-toggle { display: grid; }
  .topbar { height: 62px; padding: 0 14px; }
  .main-content { padding: 24px 14px 35px; }
  .page-header { display: block; margin-bottom: 23px; }
  .header-actions { margin-top: 16px; }
  .workspace-layout { display: block; }
  .workspace-rail { position: static; display: flex; overflow-x: auto; margin-bottom: 12px; padding: 7px; }
  .workspace-rail-label { display: none; }
  .task-nav-btn { width: auto; white-space: nowrap; }
  .workspace-layout .output-column { margin-top: 13px; }
  .parameter-grid, .api-row { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr; }
  .library-toolbar { flex-wrap: wrap; }
  .library-toolbar input { max-width: none; flex: 1 1 100%; }
  .model-grid { grid-template-columns: 1fr 1fr; }
}
