:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
  --bg: #0f1117; --panel: #171a23; --panel2: #202431; --line: #303646;
  --text: #f4f6fb; --muted: #9ca5b8; --accent: #7c66ff; --green: #4bc58d;
  --red: #ef6f79; --amber: #f2b84b;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 20% 0%, #22203d 0, var(--bg) 40%); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { border: 1px solid transparent; border-radius: 9px; background: var(--accent); color: white; padding: 9px 14px; cursor: pointer; }
button:hover { filter: brightness(1.08); } button:disabled { opacity: .5; cursor: not-allowed; }
button.ghost { background: transparent; border-color: var(--line); } button.danger { background: #52242b; border-color: #793641; }
.hidden { display: none !important; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); padding: 30px; background: rgba(23,26,35,.95); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 30px 80px #0008; }
.brand-mark { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; background: linear-gradient(135deg,#9b78ff,#526dff); font-size: 26px; font-weight: 800; }
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; font-size: 18px; }
.login-card h1 { margin-bottom: 6px; }.login-card p { color: var(--muted); margin-top: 0; }
label { display: grid; gap: 7px; color: var(--muted); margin: 16px 0; }
label.inline { display: flex; align-items: center; flex-wrap: nowrap; gap: 8px; white-space: nowrap; }
input, select, textarea { width: 100%; color: var(--text); background: #10131a; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
label.inline input[type="checkbox"] { width: 16px; height: 16px; flex: 0 0 16px; margin: 0; padding: 0; }
textarea { min-height: 120px; resize: vertical; font-family: ui-monospace, monospace; }
.login-card button { width: 100%; }.error { color: var(--red); margin-top: 12px; min-height: 20px; }
.app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
aside { position: sticky; top: 0; height: 100vh; padding: 18px; display: flex; flex-direction: column; gap: 18px; background: #12151dcc; backdrop-filter: blur(18px); border-right: 1px solid var(--line); }
aside header { display: flex; align-items: center; gap: 10px; } aside header small { display: block; color: var(--muted); margin-top: 3px; }
nav { display: grid; gap: 5px; flex: 1; } nav button { text-align: left; background: transparent; color: var(--muted); } nav button.active { color: white; background: var(--panel2); border-color: var(--line); }
main { min-width: 0; }.topbar { height: 72px; display: flex; align-items: center; gap: 14px; padding: 0 26px; border-bottom: 1px solid var(--line); background: #0f1117bb; position: sticky; top: 0; z-index: 5; backdrop-filter: blur(14px); }
.topbar h2 { margin: 0; flex: 1; }.content { padding: 24px; }
.grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }.grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; min-width: 0; }.card h3 { margin-top: 0; }
.metric { font-size: 30px; font-weight: 750; margin-top: 8px; }.muted { color: var(--muted); }.success { color: var(--green); }.warning { color: var(--amber); }.danger-text { color: var(--red); }
.toolbar { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-bottom: 14px; }.toolbar input,.toolbar select { width: auto; min-width: 150px; }.toolbar .spacer { flex: 1; }
.toolbar label.compact { margin: 0; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.toolbar label.compact input { min-width: 190px; }
.task-filters { align-items: end; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }th,td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }th { color: var(--muted); font-weight: 600; background: #1a1e28; position: sticky; top: 0; }tr:hover td { background: #1b1f2a; }
.chip { display: inline-flex; padding: 3px 8px; border-radius: 999px; background: #282e3c; color: #dce2ef; font-size: 12px; }.chip.success { background: #17382d; }.chip.error { background: #482329; }.chip.running { background: #27345a; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }.actions button { padding: 6px 9px; font-size: 12px; }
dialog { width: min(980px, calc(100% - 28px)); max-height: 88vh; overflow: auto; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }dialog::backdrop { background: #000a; backdrop-filter: blur(4px); }dialog footer { display: flex; justify-content: flex-end; margin-top: 16px; }
.editor-dialog { width: min(680px, calc(100% - 28px)); }
.editor-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.editor-dialog header h2 { margin: 0; }
.editor-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 14px; }
.editor-fields .wide { grid-column: 1 / -1; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #10131a; }
.checkbox-grid label { margin: 0; display: flex; align-items: center; gap: 8px; color: var(--text); }
.checkbox-grid input { width: 16px; margin: 0; }
.organization-card { display: grid; gap: 12px; }
.organization-card > header { display: flex; align-items: start; gap: 12px; }
.organization-card > header h3 { margin: 0 0 4px; }
.organization-card .wallet-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.organization-card .wallet-strip span { padding: 6px 9px; border-radius: 8px; background: #10131a; border: 1px solid var(--line); }
.preview-dialog { width: min(1200px, calc(100% - 20px)); }.preview-dialog img,.preview-dialog video { display: block; max-width: 100%; max-height: 70vh; margin: auto; border-radius: 10px; }.preview-dialog audio { width: 100%; }
.artifact-list { display: grid; gap: 10px; }.artifact { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #11141b; word-break: break-all; }
pre { white-space: pre-wrap; word-break: break-word; background: #0e1016; border: 1px solid var(--line); padding: 12px; border-radius: 10px; max-height: 360px; overflow: auto; }
code { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 12px; word-break: break-all; }
.safe-link { color: #a99aff; text-underline-offset: 3px; }
#toast { position: fixed; right: 18px; bottom: 18px; max-width: 420px; padding: 12px 15px; border-radius: 10px; background: #262c3a; box-shadow: 0 10px 40px #0009; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; z-index: 100; }#toast.show { opacity: 1; transform: none; }
#mobile-menu { display: none; }
@media (max-width: 980px) { .grid { grid-template-columns: repeat(2,minmax(0,1fr)); }.app-shell { grid-template-columns: 210px 1fr; } }
@media (max-width: 720px) {
  .app-shell { display: block; }.app-shell aside { position: fixed; z-index: 20; width: 260px; transform: translateX(-110%); transition: .2s; }.app-shell.menu-open aside { transform: none; }
  #mobile-menu { display: inline-block; }.content { padding: 14px; }.topbar { padding: 0 14px; }.grid,.grid.two { grid-template-columns: 1fr; }
  .editor-fields,.checkbox-grid { grid-template-columns: 1fr; }
}
