
:root{
  --bg:#f6f8fb;
  --panel:#ffffff;
  --border:#dbe2ea;
  --muted:#64748b;
  --text:#0f172a;
  --accent:#0f172a;
  --hover:#eef2f7;
  --blue-bg:#dbeafe;
  --blue-text:#1d4ed8;
  --amber-bg:#fef3c7;
  --amber-text:#92400e;
  --green-bg:#dcfce7;
  --green-text:#166534;
  --slate-bg:#e2e8f0;
  --slate-text:#475569;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:var(--bg);
  color:var(--text);
}
.app-shell{height:100vh;padding:16px}
.layout{
  height:100%;
  display:grid;
  grid-template-columns:320px minmax(0,1fr);
  gap:16px;
  max-width:1500px;
  margin:0 auto;
}
.sidebar,.content{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:20px;
  overflow:hidden;
}
.sidebar{
  display:flex;
  flex-direction:column;
  min-height:0;
}
.sidebar-head{
  padding:18px;
  border-bottom:1px solid var(--border);
}
.sidebar-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.sidebar-top h1{
  margin:0;
  font-size:18px;
  line-height:1.2;
}
.subtitle{
  margin-top:6px;
  color:var(--muted);
  font-size:13px;
}
.admin-pill{
  background:var(--accent);
  color:#fff;
  border-radius:999px;
  padding:8px 12px;
  font-size:13px;
  font-weight:700;
}
.search-row{
  margin-top:14px;
  display:flex;
  align-items:center;
  gap:10px;
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px 12px;
  background:#fff;
}
.search-row input{
  border:0;
  outline:none;
  width:100%;
  font-size:14px;
  background:transparent;
  color:var(--text);
}
.action-row{
  margin-top:14px;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}
.action-btn{
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  border-radius:12px;
  padding:10px 12px;
  font-weight:600;
  cursor:pointer;
}
.action-btn:hover{background:var(--hover)}
.sidebar-tree{
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
  padding:12px 10px 18px;
}
.tree-section{margin-bottom:8px}
.tree-header{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  background:transparent;
  border:0;
  padding:6px 8px;
  border-radius:8px;
  cursor:pointer;
  font-size:14px;
  font-weight:700;
  color:var(--text);
}
.tree-header:hover{background:var(--hover)}
.tree-left{display:flex;align-items:center;gap:8px}
.tree-count{
  color:var(--muted);
  font-size:12px;
}
.tree-items{display:none;padding-left:18px}
.tree-section.open .tree-items{display:block}
.tree-empty{
  color:var(--muted);
  font-size:13px;
  padding:4px 8px 6px;
}
.tree-item{
  display:block;
  width:100%;
  background:transparent;
  border:0;
  text-align:left;
  padding:5px 8px;
  cursor:pointer;
  border-radius:8px;
  color:var(--text);
}
.tree-item:hover{background:var(--hover)}
.tree-item.active{background:#e8eef8}
.tree-item-title{
  font-size:14px;
  line-height:1.25;
}
.tree-item-meta{
  margin-top:2px;
  font-size:12px;
  color:var(--muted);
}
.content{
  display:flex;
  flex-direction:column;
  min-height:0;
}
.content-head{
  padding:20px;
  border-bottom:1px solid var(--border);
  background:#fff;
}
.kicker{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:var(--muted);
  font-weight:700;
}
.content-title{
  margin:8px 0 0;
  font-size:28px;
  line-height:1.15;
}
.meta-row{
  margin-top:12px;
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
  color:var(--muted);
  font-size:14px;
}
.mode-pill{
  border:1px solid var(--border);
  border-radius:999px;
  padding:6px 10px;
  font-size:12px;
  font-weight:700;
  color:var(--text);
}
.content-body{
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
  padding:20px;
  display:flex;
  flex-direction:column;
  gap:16px;
}
.card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:18px;
  padding:18px;
}
.card h3{
  margin:0 0 14px;
  font-size:16px;
}
.grid-2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}
.field{
  display:flex;
  flex-direction:column;
  gap:8px;
}
label{
  font-size:13px;
  font-weight:600;
  color:#334155;
}
.input,.textarea,.select{
  width:100%;
  border:1px solid var(--border);
  border-radius:12px;
  padding:11px 12px;
  font:inherit;
  color:inherit;
  background:#fff;
}
.textarea{
  resize:vertical;
  min-height:100px;
}
.textarea.details{min-height:220px}
.actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:16px;
}
.btn{
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  color:var(--text);
  padding:10px 14px;
  font-weight:700;
  cursor:pointer;
}
.btn:hover{background:var(--hover)}
.btn.primary{
  background:var(--accent);
  color:#fff;
  border-color:var(--accent);
}
.btn.danger{
  color:#991b1b;
  border-color:#fecaca;
  background:#fff5f5;
}
.preview-text,.notes-text{
  white-space:pre-wrap;
  line-height:1.8;
  color:#334155;
}
.empty-state{
  color:var(--muted);
  line-height:1.8;
}
.toggle-line{
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--text);
  font-size:14px;
  font-weight:600;
}
.progress{
  display:inline-flex;
  align-items:center;
  border-radius:999px;
  padding:5px 10px;
  font-size:12px;
  font-weight:700;
}
.progress.not-started{background:var(--slate-bg);color:var(--slate-text)}
.progress.parked{background:var(--amber-bg);color:var(--amber-text)}
.progress.in-progress{background:var(--blue-bg);color:var(--blue-text)}
.progress.closed{background:var(--green-bg);color:var(--green-text)}
@media (max-width: 960px){
  .app-shell{height:auto;padding:12px}
  .layout{grid-template-columns:1fr;height:auto}
  .sidebar,.content{min-height:420px}
  .grid-2{grid-template-columns:1fr}
}


/* Third-pass tree cleanup */
.tree-folder {
  margin-left: 10px;
}
.tree-folder-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: transparent;
  border: 0;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}
.tree-folder-header:hover { background: var(--hover); }
.tree-folder-left { display: flex; align-items: center; gap: 8px; }
.tree-folder-items {
  display: none;
  padding-left: 16px;
}
.tree-folder.open .tree-folder-items {
  display: block;
}
.tree-item {
  padding: 4px 8px;
}
.tree-item-title {
  font-size: 13px;
}
.tree-item-meta {
  display: none;
}

.status-bar{
  padding:10px 20px;
  border-bottom:1px solid var(--border);
  background:#f8fafc;
  color:var(--muted);
  font-size:13px;
}
.status-bar.ok{color:#166534;background:#f0fdf4}
.status-bar.warn{color:#92400e;background:#fffbeb}
.status-bar.error{color:#991b1b;background:#fef2f2}
