:root{
  --bg:#ffffff;
  --panel:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e6e8f0;
  --shadow: 0 10px 30px rgba(15, 23, 42, .06);
  --shadow2: 0 6px 18px rgba(15, 23, 42, .08);
  --radius:18px;
  --radius2:14px;
  --accent:#c6631a;     /* orange */
  --accent2:#e07a2f;    /* hover */
  --pill:#f1f3f8;
  --pillActive:#1f2937;
  --focus: rgba(198,99,26,.22);
}

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

.wrap{
  max-width: 1180px;
  margin: 26px auto 36px;
  padding: 0 18px;
}

/* Header */
.top{
  display:flex;
  gap:18px;
  align-items:center;
  justify-content:space-between;
  background: var(--panel);
  border:1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px;
  box-shadow: var(--shadow);
}
.brand{
  display:flex;
  gap:12px;
  align-items:flex-start;
  min-width: 260px;
}
.brandMark{
  width:30px; height:30px;
  border-radius:10px;
  background: linear-gradient(180deg, var(--accent), #b65412);
  box-shadow: 0 10px 22px rgba(198,99,26,.22);
  flex: 0 0 auto;
  margin-top: 2px;
}
.brand h1{
  margin:0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing:.2px;
}
.brand p{
  margin:3px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 290px;
}

.searchRow{
  flex: 1 1 auto;
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:center;
  min-width: 240px;
}
.search{
  width: min(560px, 100%);
  position:relative;
}
.search input{
  width:100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  outline:none;
  background:#fff;
  font-size: 14px;
  box-shadow: inset 0 0 0 1px transparent;
}
.search input:focus{
  border-color: rgba(198,99,26,.45);
  box-shadow: 0 0 0 4px var(--focus);
}

.actions{
  display:flex;
  flex-direction:column;
  gap:10px;
  align-items:flex-end;
  min-width: 140px;
}
.btn{
  border:none;
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 650;
  cursor:pointer;
  font-size: 13.5px;
  transition: transform .06s ease, background .12s ease, box-shadow .12s ease;
}
.btn:active{ transform: translateY(1px); }
.btnPrimary{
  background: var(--accent);
  color:#fff;
  box-shadow: 0 10px 24px rgba(198,99,26,.22);
}
.btnPrimary:hover{ background: var(--accent2); }
.btnGhost{
  background:#fff;
  border:1px solid var(--border);
  color: var(--text);
}
.btnGhost:hover{ box-shadow: var(--shadow2); }

/* Layout */
.grid{
  display:grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  margin-top: 18px;
}

.card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.side{
  padding: 18px;
  position:sticky;
  top: 16px;
  height: fit-content;
}

.section{
  padding: 6px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.section:last-child{
  border-bottom:none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.section h3{
  margin:0;
  font-size: 14px;
  font-weight: 800;
  letter-spacing:.2px;
}
.section p{
  margin:6px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.pillRow{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  margin-top: 12px;
}
.pill{
  border:1px solid var(--border);
  background:#fff;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  cursor:pointer;
  user-select:none;
  transition: box-shadow .12s ease, background .12s ease, border-color .12s ease, transform .06s ease;
}
.pill:hover{ box-shadow: var(--shadow2); }
.pill:active{ transform: translateY(1px); }
.pill.active{
  background: rgba(15,23,42,.92);
  color:#fff;
  border-color: rgba(15,23,42,.92);
}

.tip{
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* Main */
.main{
  padding: 18px;
}
.mainHead{
  display:flex;
  justify-content:space-between;
  gap: 12px;
  align-items:flex-start;
  margin-bottom: 12px;
}
.mainHead h2{
  margin:0;
  font-size: 16px;
  font-weight: 850;
  letter-spacing:.2px;
}
.mainHead p{
  margin:4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.badge{
  margin-top: 2px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--muted);
  white-space:nowrap;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .06);
}

.intentBlock{
  border:1px solid var(--border);
  background:#fff;
  border-radius: 16px;
  padding: 14px;
  margin: 0 0 8px;
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
}
.intentLabel{
  display:block;
  margin:0 0 8px;
  font-size:16px;
  font-weight: 850;
  letter-spacing:.2px;
  color: var(--text);
}
.intentInput{
  width:100%;
  padding: 10px 12px;
  border-radius: 12px;
  border:1px solid var(--border);
  font-size: 13px;
  outline:none;
}
.intentInput:focus{
  border-color: rgba(198,99,26,.45);
  box-shadow: 0 0 0 3px var(--focus);
}
.intentChips{
  margin-top: 10px;
}
.intentChip{
  background: var(--pill);
}

.whyLine{
  margin: 6px 0 8px;
  font-size: 12.5px;
  color: var(--muted);
  padding: 4px 2px 0;
}

.patternsCard{
  border:1px solid var(--border);
  background: #fff;
  border-radius: 16px;
  padding: 10px 12px;
  margin: 0 0 8px;
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
}
.patternsHead{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
}
.patternsTitle{
  font-size: 13px;
  font-weight: 800;
}
.patternsToggle{
  border:1px solid var(--border);
  background:#fff;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11.5px;
  cursor:pointer;
}
.patternsToggle:hover{
  box-shadow: var(--shadow2);
}
.patternsList{
  margin:8px 0 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--muted);
}
.patternsList li{
  margin: 2px 0;
}
.patternsCard.collapsed .patternsList{
  display:none;
}

.quickCard{
  border:1px solid var(--border);
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin: 10px 0 12px;
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
}
.quickCard h4{
  margin:0;
  font-size: 14px;
  font-weight: 850;
}
.quickCard p{
  margin:4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}
.quickCard .btnGhost{
  padding: 9px 12px;
  border-radius: 12px;
}

.list{
  display:flex;
  flex-direction:column;
  gap: 10px;
  margin-top: 8px;
  min-height: 220px;
}
.item{
  border:1px solid var(--border);
  background:#fff;
  border-radius: 16px;
  padding: 12px 12px;
  display:flex;
  gap: 12px;
  align-items:flex-start;
  justify-content:space-between;
  cursor:pointer;
  transition: box-shadow .12s ease, transform .06s ease, border-color .12s ease;
}
.item:hover{ box-shadow: var(--shadow2); border-color: rgba(198,99,26,.22); }
.item:active{ transform: translateY(1px); }
.item.disabled{
  opacity:.5;
  cursor:not-allowed;
}
.leftCol{
  display:flex;
  gap: 10px;
  align-items:flex-start;
  min-width: 0;
}
.mediaIcon{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--border);
  display:grid;
  place-items:center;
  font-size: 14px;
  flex: 0 0 auto;
  background: #fff;
}
.meta{
  min-width: 0;
}
.meta .t{
  font-weight: 850;
  font-size: 13.5px;
  margin:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 600px;
}
.meta .s{
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 680px;
}
.tags{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top: 8px;
}
.tag{
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--pill);
  color: #111827;
  cursor:pointer;
  user-select:none;
}
.tag:hover{ box-shadow: var(--shadow2); }
.rightCol{
  display:flex;
  flex-direction:column;
  gap:8px;
  align-items:flex-end;
  flex: 0 0 auto;
  padding-left: 10px;
}
.typeChip{
  font-size: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
}

/* Modal */
.overlay{
  position:fixed;
  inset:0;
  background: rgba(15, 23, 42, .52);
  display:none;
  align-items:flex-start;
  justify-content:center;
  padding: 18px;
  z-index: 50;
}
.overlay.show{ display:flex; }
.modal{
  width: min(980px, 100%);
  background:#fff;
  border-radius: 18px;
  border:1px solid rgba(255,255,255,.18);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  overflow:hidden;
}
.modalHead{
  display:flex;
  justify-content:space-between;
  gap: 12px;
  align-items:flex-start;
  padding: 14px 14px;
  border-bottom:1px solid var(--border);
  background: #fff;
}
.modalHead h3{
  margin:0 0 4px;
  font-size: 14px;
  font-weight: 850;
  letter-spacing:.2px;
}
.modalHead .mini{
  margin-top:6px;
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}
.x{
  border:1px solid var(--border);
  background:#fff;
  border-radius: 12px;
  padding: 8px 10px;
  cursor:pointer;
  font-weight: 850;
}
.x:hover{ box-shadow: var(--shadow2); }
.modalBody{
  padding: 14px;
  background: #fff;
}
.viewer{
  border:1px solid var(--border);
  border-radius: 16px;
  background: #0b1020;
  overflow:hidden;
}
.viewer img{
  width:100%;
  height:auto;
  display:block;
  background:#0b1020;
}
.viewer video, .viewer audio{
  width:100%;
  display:block;
  background:#0b1020;
}
.modalFoot{
  padding: 12px 14px;
  border-top:1px solid var(--border);
  display:flex;
  justify-content:space-between;
  gap: 10px;
  align-items:center;
  background:#fff;
}
.muted{
  color: var(--muted);
  font-size: 12.5px;
}

.smallBtns{
  display:flex;
  gap:8px;
  align-items:center;
}
.btnSmall{
  border:1px solid var(--border);
  background:#fff;
  border-radius: 12px;
  padding: 8px 10px;
  cursor:pointer;
  font-weight: 750;
  font-size: 12.5px;
}
.btnSmall:hover{ box-shadow: var(--shadow2); }

/* Responsive */
@media (max-width: 980px){
  .grid{ grid-template-columns: 1fr; }
  .side{ position:relative; top:auto; }
  .brand{ min-width: 0; }
  .actions{ min-width: 120px; }
  .meta .t{ max-width: 60vw; }
  .meta .s{ max-width: 70vw; }
}