:root {
  --bg: #0c0e0d;
  --panel: #151817;
  --panel-2: #1b1e1c;
  --line: #30342f;
  --muted: #939c94;
  --text: #f1f1e9;
  --gold: #e7b45f;
  --gold-2: #f1c981;
  --mint: #8ad2b4;
  --danger: #e17e7e;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 72% 18%, rgba(228, 177, 92, .07), transparent 34%), var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 220px 1fr; }
.sidebar { border-right: 1px solid var(--line); padding: 20px 18px; display: flex; flex-direction: column; background: #121513; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 34px; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: #1a1a15; background: linear-gradient(145deg, var(--gold-2), #c89b4e); font-size: 18px; box-shadow: 0 10px 24px rgba(229, 175, 85, .18); }
.brand-copy { font-size: 18px; }
.nav { display: grid; gap: 7px; }
.nav button { display: flex; align-items: center; gap: 12px; border: 0; color: #aeb5ad; background: transparent; padding: 12px 13px; border-radius: 10px; text-align: left; transition: .18s ease; }
.nav button:hover, .nav button.active { color: var(--text); background: linear-gradient(90deg, rgba(231, 180, 95, .17), rgba(231, 180, 95, .04)); }
.nav .icon { width: 20px; color: var(--gold-2); text-align: center; }
.sidebar-spacer { flex: 1; }
.start-card { border: 1px solid rgba(231, 180, 95, .45); background: linear-gradient(135deg, #e9b864, #d29b4d); color: #282119; border-radius: 13px; padding: 14px; display: flex; gap: 10px; align-items: center; box-shadow: 0 12px 30px rgba(231, 180, 95, .12); }
.start-card strong { display: block; font-size: 14px; }
.start-card small { opacity: .8; }
.notice { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.5; }

.main { padding: 22px 30px 40px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.eyebrow { color: var(--mint); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
h1 { font-size: 23px; margin: 7px 0 4px; letter-spacing: -.03em; }
.subtitle { margin: 0; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.ghost, .outline, .pill { border: 1px solid var(--line); background: #171a18; color: var(--text); border-radius: 9px; padding: 9px 12px; }
.ghost:hover, .outline:hover { border-color: #62685f; }
.lang { min-width: 74px; }
.credits { color: var(--gold-2); font-weight: 700; font-size: 13px; padding: 0 8px; }
.avatar { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: #232721; color: var(--text); }

.toolbar { margin-top: 26px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tabs, .toolbar-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 8px 11px; border-radius: 8px; }
.tab.active { color: var(--text); border-color: #747763; background: #20231f; }
.tab:hover { color: var(--text); }

.workspace { max-width: 1180px; margin: 34px auto 0; }
.composer { border: 1px solid #3b3e34; background: linear-gradient(135deg, rgba(35, 37, 31, .96), rgba(23, 26, 24, .98)); border-radius: 17px; padding: 18px; box-shadow: 0 18px 60px rgba(0, 0, 0, .25); }
.composer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.mode-tag { border: 1px solid #4b4f43; background: #20231f; border-radius: 8px; padding: 8px 10px; color: var(--gold-2); font-size: 13px; }
.switches { display: flex; gap: 16px; color: var(--muted); font-size: 12px; }
.switch { display: inline-flex; align-items: center; gap: 7px; }
.switch input { appearance: none; width: 30px; height: 17px; border-radius: 99px; background: #383d36; position: relative; }
.switch input::after { content: ""; position: absolute; width: 13px; height: 13px; top: 2px; left: 2px; background: #d5d8ce; border-radius: 50%; transition: .16s ease; }
.switch input:checked { background: var(--gold); }
.switch input:checked::after { left: 15px; background: #fff9e7; }
.reference-row { display: flex; gap: 10px; }
.upload { flex: 0 0 155px; height: 46px; border: 1px dashed #4a5048; background: #181b19; color: var(--muted); border-radius: 9px; }
.upload:hover { color: var(--text); border-color: var(--gold); }
.prompt-label { display: block; color: var(--muted); font-size: 12px; margin: 30px 0 9px; }
textarea { width: 100%; min-height: 110px; resize: vertical; color: var(--text); background: transparent; border: 0; outline: 0; font-size: 16px; line-height: 1.55; }
textarea::placeholder { color: #747b72; }
.prompt-footer { border-top: 1px solid var(--line); padding-top: 13px; display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; }
.field-row { display: flex; flex-wrap: wrap; gap: 8px; }
.select-wrap { display: grid; gap: 5px; }
.select-wrap label { color: var(--muted); font-size: 11px; }
select { min-width: 115px; border: 1px solid var(--line); background: #151815; color: var(--text); border-radius: 8px; padding: 10px 11px; }
.generate-row { display: flex; align-items: center; gap: 13px; white-space: nowrap; }
.cost { color: var(--gold-2); font-size: 13px; }
.primary { border: 0; color: #272116; background: linear-gradient(135deg, #f2ce8b, #dba657); border-radius: 9px; padding: 12px 16px; font-weight: 800; box-shadow: 0 9px 22px rgba(231, 180, 95, .2); }
.primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.section-head { display: flex; justify-content: space-between; align-items: center; margin: 38px 0 14px; }
.section-head h2 { font-size: 15px; margin: 0; }
.section-head span { color: var(--muted); font-size: 12px; }
.task-list { display: grid; gap: 9px; }
.task { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); background: #141716; padding: 12px 14px; border-radius: 11px; }
.task-icon { width: 34px; height: 34px; border-radius: 8px; background: #222620; display: grid; place-items: center; color: var(--gold-2); }
.task-main { min-width: 0; flex: 1; }
.task-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.task-meta { color: var(--muted); font-size: 11px; margin-top: 4px; }
.status { padding: 5px 8px; border-radius: 99px; font-size: 11px; color: var(--mint); background: rgba(138, 210, 180, .1); }
.status.running { color: var(--gold-2); background: rgba(231, 180, 95, .1); }
.empty { border: 1px dashed #3b4039; border-radius: 12px; padding: 28px; color: var(--muted); text-align: center; }

.admin-panel { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .62); align-items: center; justify-content: center; padding: 24px; z-index: 5; }
.admin-panel.open { display: flex; }
.admin-card { width: min(860px, 100%); max-height: 85vh; overflow: auto; border: 1px solid #454a42; border-radius: 16px; background: #171a18; padding: 22px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.admin-head h2 { margin: 0; font-size: 18px; }
.admin-tabs { display: flex; gap: 7px; flex-wrap: wrap; margin: 18px 0 8px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.stat { border: 1px solid var(--line); background: #121513; border-radius: 10px; padding: 15px; }
.stat span { display: block; color: var(--muted); font-size: 11px; }
.stat strong { display: block; color: var(--gold-2); font-size: 24px; margin-top: 7px; }
.danger { color: var(--danger); }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.admin-form { display: grid; gap: 8px; }
.admin-form label { color: var(--muted); font-size: 12px; }
.admin-form input, .admin-form select { width: 100%; border: 1px solid var(--line); background: #111312; color: var(--text); border-radius: 8px; padding: 10px; }
.provider-list { margin-top: 20px; display: grid; gap: 8px; }
.provider { display: flex; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; }
.provider strong { flex: 1; font-size: 13px; }
.provider small { color: var(--muted); }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 4; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; }
  .brand { margin-bottom: 10px; }
  .nav { display: flex; overflow-x: auto; gap: 4px; }
  .nav button { flex: 0 0 auto; padding: 9px 10px; }
  .nav button span:last-child { display: none; }
  .sidebar-spacer, .start-card, .notice { display: none; }
  .main { padding: 18px 14px 34px; }
  .topbar { align-items: center; }
  .top-actions .ghost { display: none; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .prompt-footer { align-items: stretch; flex-direction: column; }
  .generate-row { justify-content: space-between; }
  .admin-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
