*{box-sizing:border-box}
:root{
  --bg:#0b0c10;
  --panel:#12141a;
  --text:#e6e6e6;
  --muted:#9aa1ad;
  --border:#1f2229;
  --border-soft:#252a33;
  --hover:#232a3a;
  --active:#1b1f27;
  /* Fairy palette */
  --accent:#A163F7;   /* primary: purple */
  --accent-2:#6F88FC; /* secondary: blue */
  --accent-3:#45E3FF; /* bright cyan */
  --danger:#FF7582;
}
body{margin:0;font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial;background:var(--bg);color:var(--text)}
button,input,textarea,select{font-family:inherit;font-size:14px}
.container{display:flex;height:100vh}
.sidebar{width:320px;display:flex;flex-direction:column;border-right:1px solid var(--border);background:var(--panel)}
.section{padding:12px;display:flex;flex-direction:column;gap:16px}
.section h3{margin:0 0 6px 0;font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:var(--accent-2)}
.list{flex:1;overflow:auto;border:1px solid var(--border-soft);border-radius:8px}
.list-item{padding:10px 12px;border-bottom:1px solid var(--border);cursor:pointer;transition:background .15s ease,color .15s ease,border-left-color .15s ease; border-left:3px solid transparent}
.list-item:hover:not(.active){background:rgba(111,136,252,0.10);border-left-color:var(--accent-2);color:#fff}
.list-item.active{background:rgba(161,99,247,0.12);border-left-color:var(--accent)}
.list-item.active:hover{filter:brightness(1.05)}
.actions{display:flex;gap:8px}
.btn{background:var(--accent);color:#fff;border:1px solid transparent;border-radius:6px;padding:8px 12px;cursor:pointer;display:inline-flex;align-items:center;gap:8px}
.btn:hover{filter:brightness(1.05); box-shadow:0 0 0 2px rgba(161,99,247,0.25)}
.btn.secondary{background:rgba(111,136,252,0.16);color:#dfe4ff}
.btn.secondary:hover{background:rgba(111,136,252,0.24)}
.btn.success{background:#1e7f41}
.btn.success:hover{filter:brightness(1.05)}
.btn.danger{background:var(--danger)}
.btn.danger:hover{filter:brightness(1.05)}
.input,.textarea{width:100%;padding:8px 10px;border:1px solid #2a2f39;border-radius:6px;background:#0f1117;color:#e6e6e6}
.input:focus,.textarea:focus{outline:none;border-color:var(--accent-2);box-shadow:0 0 0 2px rgba(111,136,252,0.2)}
.main{flex:1;display:flex;flex-direction:column}
.topbar{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--border)}
.content{flex:1;display:flex}
.editor{flex:1;padding:20px;overflow:auto}
.editor h3{margin:0 0 16px}
.editor > * + *{ margin-top:20px }
.row + .row{ margin-top:12px }
.editor .input,.editor .textarea{ margin-bottom:14px }
.row{display:flex;gap:16px;align-items:center;flex-wrap:wrap}
.grid{overflow:auto;border:1px solid #2a2f39;border-radius:8px;margin-top:20px}
.editor .grid + .btn{ margin-top:16px }
.editor .btn + .row{ margin-top:16px }
.editor .grid + .row{ margin-top:16px }
.ace-wrap{ margin-top:16px }
.ace-wrap .ace_editor{ border-radius:8px }
.table{border-collapse:collapse;width:auto;max-width:100%;table-layout:auto}
.table th{border:1px solid #242a33;padding:6px 8px;background:rgba(111,136,252,0.12);color:#e8ecff;white-space:nowrap}
.table td{border:1px solid #242a33;padding:0;vertical-align:middle}
/* remove double borders: inputs fill cell without their own border */
.table td .input{
  width: 100%;
  display: block;
  border: 0;
  background: transparent;
  padding: 8px 8px !important;
  margin: 0px;
  outline: none;
  min-width: 0;
  color: var(--text);
  height: 30px;
  min-height: 35px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* textarea cells: no manual resize, hide scrollbars (auto-height handled in JS) */
.table td textarea.input{ resize: none; overflow: hidden; }
/* consistent row height */
.table tbody tr{ height: 36px }
.table td .input:focus{box-shadow:inset 0 0 0 1px var(--accent-2), 0 0 0 2px rgba(111,136,252,0.15)}
.table tbody tr{transition:background .15s ease,border-left-color .15s ease; border-left:3px solid transparent}
.table tbody tr:hover{background:rgba(69,227,255,0.08);border-left-color:var(--accent-3)}
.table tbody tr:hover input.input{background:#0f141d}
.split{display:flex;gap:12px}
.hidden{display:none}
.code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;line-height:1.4;background:#0f1117;border:1px solid #2a2f39;border-radius:8px;padding:8px}
.preview{position:relative;width:50%;border-left:1px solid var(--border);background:#0d0f15;display:flex;flex-direction:column}
.preview{align-items:stretch}
.preview iframe{width:100%;height:auto;flex:1;border:0;background:#fff;max-width:1200px;margin:0 auto;display:block}
.auth{max-width:420px;margin:80px auto;display:flex;flex-direction:column;gap:10px;background:#12141a;border:1px solid #1f2229;border-radius:12px;padding:16px}
label{font-size:12px;color:#9aa1ad}
.small{font-size:12px;color:#9aa1ad}
.toasts{position:fixed;top:16px;right:16px;display:flex;flex-direction:column;gap:8px;z-index:9999}
.toast{display:flex;align-items:center;gap:8px;min-width:220px;max-width:360px;padding:10px 12px;border-radius:10px;border:1px solid var(--border-soft);background:rgba(18,20,26,0.95);color:var(--text);box-shadow:0 8px 24px rgba(0,0,0,0.35);opacity:0;transform:translateY(-6px);transition:opacity .18s ease, transform .18s ease}
.toast.show{opacity:1;transform:translateY(0)}
.toast.hide{opacity:0;transform:translateY(-4px)}
.toast.success{border-color:rgba(161,99,247,0.35)}
.toast.error{border-color:rgba(255,117,130,0.55)}
