:root{
  --bg:#0b0f14;
  --panel:#111826;
  --panel2:#0f1724;
  --text:#e8eef7;
  --muted:#a9b4c4;
  --border:#223044;
  --primary:#5dd1ff;
  --danger:#ff6b6b;
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
  --radius: 14px;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height:1.35;
}

a{color:var(--primary); text-decoration:none}
a:hover{text-decoration:underline}

.topbar{
  position:sticky; top:0;
  background:rgba(11,15,20,0.85);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--border);
  padding:10px 14px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  z-index:10;
}

.brand{
  color:var(--text);
  font-weight:700;
  letter-spacing:.2px;
  text-decoration:none;
  margin-right:8px;
}
.home-pill{
  display:inline-block;
  font-size:12px;
  padding:4px 8px;
  border:1px solid var(--border);
  border-radius:999px;
  color:var(--muted);
  background:rgba(255,255,255,0.03);
  vertical-align:middle;
}
.navlink{
  margin-left:10px;
  color:var(--muted);
  font-size:14px;
}
.navlink:hover{color:var(--text); text-decoration:none}

.container{
  max-width: 980px;
  margin: 0 auto;
  padding: 14px;
}

.footer{
  padding: 20px 14px 40px;
  text-align:center;
  color: var(--muted);
}

.card{
  background: var(--panel);
  border:1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin: 12px 0;
}

.pagehead{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
  margin: 10px 0 6px;
  flex-wrap: wrap;
}
.pagehead h1{margin:0 0 4px; font-size: 22px}
.pagehead__actions{display:flex; gap:8px; align-items:center}

h1,h2,h3{margin:0 0 10px}
h2{font-size: 18px}
h3{font-size: 15px; margin-top: 10px}

label{display:block; margin: 10px 0 6px; color:var(--muted); font-size: 13px}
input, textarea, select{
  width:100%;
  padding: 10px 11px;
  border-radius: 12px;
  border:1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  outline: none;
}
textarea{resize: vertical}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding: 10px 12px;
  border-radius: 12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  cursor:pointer;
  text-decoration:none;
  font-weight: 600;
  font-size: 14px;
}
.btn:hover{filter:brightness(1.08); text-decoration:none}
.btn[disabled]{
  opacity: 0.65;
  cursor: wait;
}
.btn--primary{
  background: rgba(93,209,255,0.18);
  border-color: rgba(93,209,255,0.35);
  color: var(--text);
}
.btn--danger{
  background: rgba(255,107,107,0.15);
  border-color: rgba(255,107,107,0.35);
  color: var(--text);
}
.btn--ghost{
  background: transparent;
}
.btn--small{
  padding: 7px 10px;
  font-size: 13px;
  border-radius: 10px;
}
.btn--icon{
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  font-size: 24px;
  line-height: 1;
  font-weight: 500;
  background: transparent;
  color: var(--muted);
}
.btn--icon-danger:hover{
  color: #ffd3d3;
  border-color: rgba(255,107,107,0.45);
  background: rgba(255,107,107,0.12);
}

.inline-form{
  margin: 0;
}

.actions{display:flex; gap:10px; margin-top: 12px; flex-wrap:wrap}
.ai-status{
  display: block;
  min-height: 18px;
  margin-top: 6px;
}
.btn.is-loading{
  position: relative;
  padding-left: 34px;
}
.btn.is-loading::before{
  content: "";
  position: absolute;
  left: 12px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(232,238,247,0.35);
  border-top-color: var(--text);
  animation: btn-spin .9s linear infinite;
}
@keyframes btn-spin{
  to { transform: rotate(360deg); }
}

.muted{color: var(--muted)}
.small{font-size: 12px}
.pre{white-space: pre-wrap}

.flash-stack{margin: 10px 0}
.flash{
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  margin: 8px 0;
  font-size: 14px;
}
.flash--error{border-color: rgba(255,107,107,0.4)}
.flash--success{border-color: rgba(93,255,170,0.35)}
.flash--info{border-color: rgba(93,209,255,0.35)}

.notice{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(93,209,255,0.35);
  background: rgba(93,209,255,0.10);
  margin: 10px 0;
  color: var(--text);
  font-size: 14px;
}

.list{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255,255,255,0.02);
}
.listitem{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration:none;
}
.listitem:last-child{border-bottom:none}
.listitem:hover{background: rgba(255,255,255,0.03); text-decoration:none}
.listitem__title{font-weight:700}
.listitem__meta{font-size: 12px; color: var(--muted); margin-top: 3px}
.listitem__chev{color: var(--muted); font-size: 20px}

.list--compact .listrow{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.list--compact .listrow:last-child{border-bottom:none}
.grow{flex:1}

.templates-bar{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin: 8px 0 12px;
}
.chip{
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-size: 13px;
  text-decoration:none;
}
.chip:hover{filter:brightness(1.08); text-decoration:none}

.empty{
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align:center;
  margin-top: 14px;
}

.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 820px){
  .grid{grid-template-columns: 1fr 1fr;}
}

.steps{
  margin: 0;
  padding-left: 18px;
}
.steps li{margin: 8px 0}

.steps-editor{
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  background: rgba(255,255,255,0.02);
}
.step-row{
  display:grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items:center;
  margin-bottom: 8px;
}
.step-controls{
  display:flex;
  gap:6px;
}
.iconbtn{
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  cursor:pointer;
  font-weight:700;
}
.iconbtn:hover{filter:brightness(1.08)}
.hidden{display:none}

.row{display:flex; gap:10px}
.row--between{justify-content:space-between}
.row--center{align-items:center}

.pill{
  display:inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  border:1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  background: rgba(255,255,255,0.03);
}

.suggestions{display:flex; flex-direction:column; gap:10px}
.suggestion{
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  background: rgba(255,255,255,0.02);
}
.suggestion__meta{font-size: 13px; color: var(--muted); margin-bottom: 6px}
.suggestion__body{font-size: 14px}

.mt{margin-top: 12px}
.danger{border-color: rgba(255,107,107,0.25)}

.codebox{
  margin-top: 6px;
  padding: 10px 10px;
  border-radius: 12px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  overflow-x: auto;
  white-space: nowrap;
}
