:root{
  --bg: #0b0f17;
  --bg2:#0e1420;
  --text:#e6e9ef;
  --muted:#a7b0c0;
  --line: rgba(255,255,255,.10);
  --shadow: 0 18px 60px rgba(0,0,0,.35);
  --radius: 18px;

  --primary:#7c3aed;
  --primary2:#5b21b6;
}

[data-theme="light"]{
  --bg:#f6f7fb;
  --bg2:#ffffff;
  --text:#0b1020;
  --muted:#4b5563;
  --line: rgba(10,20,40,.10);
  --shadow: 0 18px 55px rgba(10,20,40,.12);
  --primary:#6d28d9;
  --primary2:#5b21b6;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
  background: radial-gradient(1200px 600px at 20% 0%, rgba(124,58,237,.25), transparent 60%),
              radial-gradient(1200px 600px at 90% 20%, rgba(34,197,94,.14), transparent 55%),
              linear-gradient(180deg, var(--bg), var(--bg2));
}

.bg-grid{
  position:fixed; inset:0;
  background-image: linear-gradient(to right, rgba(255,255,255,.05) 1px, transparent 1px),
                    linear-gradient(to bottom, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 46px 46px;
  opacity:.07;
  pointer-events:none;
}

.container{ width:min(1120px, 92vw); margin-inline:auto; }

.topbar{
  position:sticky; top:0; z-index:10;
  backdrop-filter: blur(12px);
  background: rgba(10,15,25,.55);
  border-bottom:1px solid var(--line);
}
[data-theme="light"] .topbar{ background: rgba(255,255,255,.72); }

.topbar__inner{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 0;
}

.brand{ display:flex; gap:12px; align-items:center; }
.brand__logo{
  width:40px;height:40px;border-radius:12px;
  display:grid;place-items:center;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  box-shadow: 0 16px 30px rgba(124,58,237,.25);
  font-weight:800;
}
.brand__text{ display:flex; flex-direction:column; }
.brand__name{ font-weight:800; letter-spacing:.2px; }
.brand__tag{ font-size:12px; color:var(--muted); margin-top:2px; }
.topbar__actions{ display:flex; gap:10px; }

.layout{
  padding:22px 0 34px;
  display:grid;
  grid-template-columns: 1.08fr .92fr;
  gap:18px;
}
@media (max-width: 980px){
  .layout{ grid-template-columns:1fr; }
  .hide-sm{ display:none; }
}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:18px;
}

.card__header{ margin-bottom:14px; }
.card__title{ margin:0; font-size:18px; letter-spacing:.2px; }
.card__subtitle{ margin:6px 0 0; color:var(--muted); font-size:13px; line-height:1.4; }

.field{ margin-top:14px; }
.label{ display:block; font-size:12px; color:var(--muted); margin-bottom:8px; }

.textarea{
  width:100%;
  min-height: 220px;
  resize: vertical;
  border-radius: 14px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.12);
  color:var(--text);
  padding:12px;
  line-height:1.5;
  outline:none;
}
[data-theme="light"] .textarea{ background: rgba(0,0,0,.03); }

.select, .input{
  width:100%;
  border-radius: 12px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.12);
  color:var(--text);
  padding:10px;
  outline:none;
}
[data-theme="light"] .select,
[data-theme="light"] .input{ background: rgba(0,0,0,.03); }

.meta-row{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; margin-top:10px; flex-wrap:wrap;
}
.meta{ font-size:12px; color:var(--muted); }
.meta-actions{ display:flex; gap:8px; }

.grid-2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
@media (max-width: 560px){ .grid-2{ grid-template-columns:1fr; } }

.divider{ height:1px; background: var(--line); margin:16px 0; }

.actions{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.actions--split{ justify-content:space-between; }

.btn{
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  color:var(--text);
  border-radius: 14px;
  padding:10px 12px;
  cursor:pointer;
  transition: transform .06s ease, background .2s ease, border-color .2s ease, opacity .2s ease;
  display:inline-flex;
  align-items:center;
  gap:8px;
  user-select:none;
}
.btn:hover{ background: rgba(255,255,255,.07); }
.btn:active{ transform: translateY(1px); }
.btn:disabled{ opacity:.55; cursor:not-allowed; }

.btn--primary{
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border-color: rgba(255,255,255,.16);
  box-shadow: 0 18px 40px rgba(124,58,237,.22);
}
.btn--primary:hover{ filter: brightness(1.05); }
.btn--ghost{ background: rgba(255,255,255,.03); }

.icon{ font-size:14px; }

.hint{ margin-top:12px; color:var(--muted); font-size:12px; }
kbd{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 10px;
  padding: 2px 8px;
  background: rgba(255,255,255,.04);
}

.status{
  border:1px dashed var(--line);
  background: rgba(255,255,255,.03);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  margin: 6px 0 12px;
}
.status--loading{ border-style: solid; color: var(--text); }
.status--ok{ border-style: solid; border-color: rgba(34,197,94,.35); }
.status--err{ border-style: solid; border-color: rgba(239,68,68,.35); color: rgba(239,68,68,.95); }

.output{
  border:1px solid var(--line);
  background: rgba(0,0,0,.10);
  border-radius: 14px;
  padding: 12px;
  min-height: 260px;
  overflow:auto;
}
[data-theme="light"] .output{ background: rgba(0,0,0,.02); }

.output h1,.output h2,.output h3{ margin-top:14px; }
.output p{ line-height:1.6; }
.output ul{ padding-left: 18px; }
.output code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  background: rgba(255,255,255,.06);
  padding: 2px 6px;
  border-radius: 10px;
}
.output pre{
  background: rgba(0,0,0,.22);
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 14px;
  overflow:auto;
}

.drawer{
  position:fixed; inset:0;
  display:none;
  z-index:30;
}
.drawer.is-open{ display:block; }
.drawer__backdrop{
  position:absolute; inset:0;
  background: rgba(0,0,0,.45);
}
.drawer__panel{
  position:absolute; top:0; right:0;
  width:min(520px, 92vw);
  height:100%;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border-left:1px solid var(--line);
  box-shadow: var(--shadow);
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.drawer__header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.drawer__title{ font-weight:800; }
.drawer__subtitle{ font-size:12px; color:var(--muted); margin-top:4px; }
.drawer__footer{ margin-top:auto; padding-top:10px; border-top:1px solid var(--line); }

.history{
  display:flex; flex-direction:column; gap:10px;
  overflow:auto;
  padding-right:4px;
}
.history__item{
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  border-radius: 14px;
  padding:10px;
}
.history__title{ font-weight:700; font-size:13px; }
.history__meta{ color:var(--muted); font-size:12px; margin-top:4px; }
.history__actions{ margin-top:10px; display:flex; gap:8px; flex-wrap:wrap; }

.toast{
  position:fixed;
  left:50%;
  bottom:18px;
  transform: translateX(-50%);
  background: rgba(10,15,25,.9);
  border:1px solid var(--line);
  color: var(--text);
  border-radius: 14px;
  padding:10px 12px;
  box-shadow: var(--shadow);
  display:none;
  z-index:40;
  font-size:13px;
}
.toast.show{ display:block; }
[data-theme="light"] .toast{ background: rgba(255,255,255,.92); }